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

Add missing WebGL1Renderer to Typescript definitions #19729

Merged
merged 1 commit into from
Jun 25, 2020

Conversation

subblue
Copy link
Contributor

@subblue subblue commented Jun 24, 2020

This adds the missing WebGL1Renderer export to the Typescript definitions.
Useful to have for those who aren't yet ready to migrate the now default WebGL2 renderer :)

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 24, 2020

Thanks for adding this!

@mrdoob mrdoob added this to the r119 milestone Jun 25, 2020
@mrdoob mrdoob merged commit 7df06a0 into mrdoob:dev Jun 25, 2020
@mrdoob
Copy link
Owner

mrdoob commented Jun 25, 2020

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Jun 25, 2020

@subblue Out of curiosity, what's the reason you're not able to use WebGL 2?

@subblue
Copy link
Contributor Author

subblue commented Jun 25, 2020

@subblue Out of curiosity, what's the reason you're not able to use WebGL 2?

We will do eventually, but we're not quite ready to migrate our custom shaders yet as it's a pretty large codebase.
Limited iOS support for WebGL2 is also potentially a blocker (or maybe it is better than when I last checked), which is a shame as I would much rather use WebGL2 across the board.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 25, 2020

Limited iOS support for WebGL2 is also potentially a blocker (or maybe it is better than when I last checked),

WebGLRenderer actually falls back to WebGL 1 if WebGL 2 is not available.

But indeed, your custom shader code has to be GLSL 3.0 conform. Otherwise shaders don't compile when using WebGL 2.

@subblue
Copy link
Contributor Author

subblue commented Jun 25, 2020

Oh interesting - is there a method then to switch between the shaders compatible with WebGL1 and WebGL2?

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 25, 2020

No, there is no switch for this. That means:

  • WebGLRenderer always tries to create a WebGL 2 rendering context.
  • WebGL 2 shader code (except of RawShaderMaterial) always runs as GLSL 3.0 code. The renderer internally converts GLSL 1 to 3. However, this conversion has limitations. E.g. it does not work when you use GLSL 3.0 keywords (like texture) as variable names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants