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

Support external GL context #603

Merged
merged 3 commits into from
Sep 26, 2018
Merged

Support external GL context #603

merged 3 commits into from
Sep 26, 2018

Conversation

Pessimistress
Copy link
Collaborator

Copy link
Contributor

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

I have overridden the mapbox context in the past however I am not sure if I tried to return a WebGL2 context.

The main problem I foresee with a WebGL2 context is that it does not support WebGL1 extensions, so if mapbox depends on certain WebGL extensions we'd have to polyfill them (or we might see reduced functionality/performance).

const getContext = HTMLCanvasElement.prototype.getContext;
if (props.gl) {
// Hijack canvas.getContext to return our own WebGLContext
HTMLCanvasElement.prototype.getContext = () => props.gl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest unhijacking as soon as done...

@Pessimistress Pessimistress merged commit 7f0909f into master Sep 26, 2018
@Pessimistress Pessimistress deleted the gl-context branch September 26, 2018 23:14
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.

2 participants