8000 Workaround Safari WebGL issue: After successfully acquiring WebGL con… by juj · Pull Request #13659 · emscripten-core/emscripten · GitHub 8000
[go: up one dir, main page]

Skip to content

Conversation

@juj
Copy link
Collaborator
@juj juj commented Mar 15, 2021

…text on a canvas, calling .getContext() will always return that context independent of which 'webgl' or 'webgl2' context version was passed. See https://bugs.webkit.org/show_bug.cgi?id=222758. Fixes #13295

…text on a canvas, calling .getContext() will always return that context independent of which 'webgl' or 'webgl2' context version was passed. See https://bugs.webkit.org/show_bug.cgi?id=222758. Fixes emscripten-core#13295
@juj juj force-pushed the workaround_safari_getcontext_bug branch from 92471c3 to 7d9e154 Compare March 15, 2021 10:40
canvas.getContextSafariWebGL2Fixed = canvas.getContext;
canvas.getContext = function(ver, attrs) {
var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs);
return ((ver == 'webgl') == (gl instanceof WebGLRenderingContext)) && gl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this end up returning "false" for getContext if this fails, rather than null? I'd suggest writing this more clearly with if-statements.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised if that matters, but sure, adjusted to return null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected "OpenGL ES 3.0 (WebGL 1.0)" reported by glGetString(GL_VERSION)

3 participants

0