Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using WebGL 2 by default #10887

Closed
sanjeetsuhag opened this issue Nov 2, 2022 · 2 comments · Fixed by #10894
Closed

Using WebGL 2 by default #10887

sanjeetsuhag opened this issue Nov 2, 2022 · 2 comments · Fixed by #10894

Comments

@sanjeetsuhag
Copy link
Contributor

sanjeetsuhag commented Nov 2, 2022

Overview

CesiumJS has been powered by WebGL 1 since the very beginning, and while support for WebGL 2 was added in 2015, as of version 1.99, CesiumJS defaults to running in a WebGL 1 context to ensure compatibility on as wide a range of devices as possible. However, given WebGL 2’s maturity and near universal support, we’re planning on switching to WebGL 2 by default. On platforms where WebGL 2 is not available, we will fallback to WebGL 1 with extensions.

Scope of Changes

On an API level, WebGL 2 is very similar to WebGL 1, however, there are a few major differences:

  • Shaders must be written in GLSL ES 300 instead of GLSL ES 100. This will require a rewrite of all CesiumJS shaders. If your application uses custom shaders or materials, they will have to be updated too.
  • Several extensions, such as ANGLE_instanced_arrays and OES_texture_float are part of the standard, so they’ll only need to be checked for when running in WebGL 1 compatibility mode.

We don’t plan on doing a complete overhaul and adopting features like uniform buffer objects immediately. The current effort is primarily targeting compliance with the WebGL 2 spec and providing an efficient fallback method to WebGL 1 where needed. In time, we see a lot of potential in using all that WebGL 2 has to offer for delivering new features and a better user experience, such as:

  • Enabling MSAA by default, resulting in improved visual quality
  • Optimizing picking
  • 3D textures for voxels and clouds

If your application already uses WebGL 2 with CesiumJS, then this change should result in better performance since we will no longer have to manually upgrade shaders from GLSL ES 100 to GLSL ES 300 at runtime.

We would like to hear any thoughts or concerns you may have regarding this change.

@an501920078
Copy link

nice

@sanjeetsuhag
Copy link
Contributor Author

Just providing an update here: the PR to enable WebGL 2 by default is ready for testing. Please try it out and let us know if you run into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Issue/PR closed
Development

Successfully merging a pull request may close this issue.

2 participants