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

Emscripten webgl context #2583

Merged
merged 7 commits into from
Jul 29, 2014

Conversation

juj
Copy link
Collaborator

@juj juj commented Jul 25, 2014

Implements a HTML5 API for creating WebGL contexts. Adds support for creating multiple GL contexts on different canvases. So far tested that browser test suite passes.

@juj
Copy link
Collaborator Author

juj commented Jul 25, 2014

Implements #2559. Related to #2515, #2540, #643 and #644.

@juj
Copy link
Collaborator Author

juj commented Jul 25, 2014

One of the things I really hate with WebGL is that it only allows setting context creation parameters as true or false, i.e. depth: false/true, alpha: false/true, stencil: false/true, antialias: false/true. There's no current way to specify how many depth bits or multisamples one would like to have.

I was thinking whether to make the creation API possibly future-proof by not having these fields represent booleans but just integers in terms of number of bits to allocate, and currently treat anything nonzero as true.. That way in the future one could say the preferred bit depth with depth: 16 or depth: 24 or depth: 32. This would be preferable and useful optimization for e.g. Firefox OS mobile. However, it seems that the argument against that is "it's too difficult to implement", see http://www.khronos.org/webgl/public-mailing-list/archives/1407/msg00055.html

Another way would be to just have the depth/stencil/alpha as true/false, and in the future, if such feature is abailable, add new fields int depthBits, int stencilBits and so on.

"EmscriptenWebGLContextAttributes": [
"alpha",
"depth",
"stencil",
Copy link
Member

Choose a reason for hiding this comment

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

these changes require bumping the version number

@kripken
Copy link
Member

kripken commented Jul 25, 2014

This looks good. Can you please check though that it does not affect perf? In particular I worry about storing properties on the context object like that (temp buffers, etc.). It shouldn't affect perf, but let's be sure.

@juj juj added the GL label Jul 27, 2014
@juj juj self-assigned this Jul 28, 2014
@juj juj added the HTML5 API label Jul 28, 2014
@juj
Copy link
Collaborator Author

juj commented Jul 29, 2014

Rebased to latest.

Tested performance on both the Firefox packaged app we've been working on earlier this year, and on my 3D engine, and I cannot observe a difference in performance.

kripken added a commit that referenced this pull request Jul 29, 2014
@kripken kripken merged commit d323e4d into emscripten-core:incoming Jul 29, 2014
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.

2 participants