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 GLEW 1.10.0 emulation #1878

Merged
merged 1 commit into from
Jan 14, 2014
Merged

Add GLEW 1.10.0 emulation #1878

merged 1 commit into from
Jan 14, 2014

Conversation

Cloudef
Copy link
Contributor

@Cloudef Cloudef commented Nov 30, 2013

Includes library_glew.js that stubs the init functions, but also provides the
other functions.

GL/glew.h is now changed to work with GLEW_EXT_foo_bar constants,
some missing constants that are in GLEW 1.10.0 are also provided.

Otherwise it still uses SDL_opengl.h to provide function definitions and
other constants.

Linaro's GLEW (glew-oes) is also supported to some degree to make it
easier to get ES1 and ES2 software using it running.

What it lacks:

  • Some constants and function declarations that are in GLEW 1.10.0
    might be missing.
  • The real glew-es fork also includes normal GL constants and
    function pointers, this does not.

Tests ran:

  • tests/runner.py browser

Real world example using this code (and upcomming glfw3 port) can be found here:
http://cloudef.eu/glhck

@Cloudef Cloudef mentioned this pull request Dec 1, 2013
@ghost ghost assigned juj Dec 11, 2013
@kripken
Copy link
Member

kripken commented Dec 11, 2013

@juj, want to take a look at this one perhaps?

glewIsSupported: function(name) {
var extensions = Pointer_stringify(name).split(" ");
for (var i = 0, len = extensions.length; i < len; i++) {
if (!(Module.ctx.getExtension(name) | 0)) return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In desktop GL/GLES2 world, extensions are prefixed with "GL_". In WebGL extension registry, all extensions start without that suffix: http://www.khronos.org/registry/webgl/extensions/ . In the function glGetString it was decided to be desirable that both unsuffixed and suffixed forms were reported, see here https://github.com/kripken/emscripten/blob/master/src/library_gl.js#L652 . Perhaps GLEW codepath should follow the suit, and be able to manage both unsuffixed and suffixed forms for consistency? (glewIsSupported and glewGetExtension)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, will change this.

@Cloudef
Copy link
Contributor Author

Cloudef commented Dec 15, 2013

@juj, should I rebase and open new pull request to keep history cleaner?
Or should, I push here first so you can see the changes before doing that.

// edit
I'll go ahead and push the changes here to be seen, since I might be away for a while starting tomorrow. I can later rebase and open new pull request for better merge and cleaner history.

@juj
Copy link
Collaborator

juj commented Dec 16, 2013

Squashing is ok - Also leaving the commits intact is ok, if there is value in having the commits individually present, like for bisecting. E.g. temp stuff, replacing commits and wip like Cloudef@1e87bb2 + Cloudef@453bebe could be amended, but it's not a worry to me when there is only a few commits. @kripken might have a more preferred recommendation.

@kripken
Copy link
Member

kripken commented Dec 16, 2013

if separate commits help bisection they should be separate, otherwise might
as well combine them. but i am not picky either way.

On Mon, Dec 16, 2013 at 7:27 AM, juj [email protected] wrote:

Squashing is ok - Also leaving the commits intact is ok, if there is value
in having the commits individually present, like for bisecting. E.g. temp
stuff, replacing commits and wip like Cloudef/emscripten@1e87bb2Cloudef@1e87bb2ed2cf7d19be9d3f365437b4d769bb504f+
Cloudef@453bebehttps://github.com/Cloudef/emscripten/commit/453bebec58a8f6730d0980ca42cbbe726b74ab41could be amended, but it's not a worry to me when there is only a few
commits. @kripken https://github.com/kripken might have a more
preferred recommendation.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1878#issuecomment-30668881
.

@Cloudef
Copy link
Contributor Author

Cloudef commented Dec 17, 2013

Since none of this code is not yet in emscripten (apart from the glew.h header change), it might be easier and cleaner to combine the commits and send new pull request when everything is good.

@jcowles
Copy link

jcowles commented Dec 19, 2013

This would be great to have.

On a related note: PixarAnimationStudios/OpenSubdiv#247 (comment)

@kripken
Copy link
Member

kripken commented Dec 29, 2013

Combining the commits sounds good then. Note that you don't need a new pull request, can just force-push to this one. Just be sure to comment afterwards, github does not send email updates on pushes, just comments.

@Cloudef
Copy link
Contributor Author

Cloudef commented Jan 5, 2014

Sounds good, I just came back from some travels. I'll try to wrap up this and GLFW3 this week.

@Cloudef
Copy link
Contributor Author

Cloudef commented Jan 8, 2014

Took a while to get back to track. So, if these looks ok I'll rebase against latest code and force push.

@juj
Copy link
Collaborator

juj commented Jan 14, 2014

Looking at the latest, I see you chose to do a different form than I recommended in #1878 (comment) . The code in Cloudef@34a97de has the inconveniency that multiple "Unknown error" strings can get cached in that array, instead of reusing the same string, so it's possible to unboundlessly grow the size of the cached state. Probably not an issue, unless client code has some kind of bug though. Feel free to rebase, looks good to merge by me.

Includes library_glew.js that stubs the init functions, but also provides the
other functions.

GL/glew.h is now changed to work with GLEW_EXT_foo_bar constants,
some missing constants that are in GLEW 1.10.0 are also provided.

Otherwise it still uses SDL_opengl.h to provide function definitions and
other constants.

Linaro's GLEW (glew-oes) is also supported to some degree to make it
easier to get ES1 and ES2 software using it running.

What it lacks:
- Some constants and function declarations that are in GLEW 1.10.0
might be missing.
- The real glew-es fork also includes normal GL constants and
function pointers, this does not.

Tests ran:
- tests/runner.py browser

Real world example using this code (and upcomming glfw3 port) can be found here:
http://cloudef.eu/glhck
http://cloudef.eu/glhck/qb.html
@Cloudef
Copy link
Contributor Author

Cloudef commented Jan 14, 2014

@juj good point there, I made it so that when string gets sets to unknown error, it forces error to 8 as well, this should keep the array from growing more than that.
I rebased and flattened the commits and ran tests again and everything seems fine.

juj added a commit that referenced this pull request Jan 14, 2014
@juj juj merged commit 899b2b4 into emscripten-core:incoming Jan 14, 2014
@juj juj added the GLEW label Jul 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants