In terms of features, pretty much WebGL is a subset of GLES2, which is a subset of modern desktop GL. Sticking to the lowest common denomination and basically writing "GLES2 without client-side rendering" gives you a good sane common ground that works across all platforms. This means not using any of the old desktop GL features such as fixed function rendering, glBegin, glVertexPointer/glColorPointer etc. Also note that the extension registryes are different for each GL, GLES and WebGL, although generally matchable. If you also want to target desktop core GL3, that's also possible, but one inconvenience there is that you need to maintain (or translate one to other - that's what I do) two sets of GLSL shader syntax. If you are working on a renderer codebase from scratch, it is best to avoid the FULL_ES2 and LEGACY_GL_EMULATION settings, which gives the best path.
Jukka
I am desktop OpenGL developer and I wonder what's the best way for me to port or write OpenGL so that it will be best compatible with WebGL .I read in Emscripten FAQ that using SDK included ES2 API is the besr choice.But I also see some of the examples use regular OpenGL .For me ,in terms of portability and usability would be best to write a normal OpenGL ,using GLEW headers.Will it be fine as long as I use only ES2 compatible API methods?
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/ZMC4l8ppDq8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Yeah, if you use GL 3 core on desktop, you'll be fairly good to go. The shader syntax translation issue is a bit annoying, e.g. in core GL3 the GLSL syntax uses the keywords in and out, whereas GLES2/WebGL still uses the old keywords attribute and varying. There are a few other syntax renames like this. What I do is I author my shaders in the old GLES2 syntax, and then when building for desktop, just use naive string replaces at startup time to convert the shaders so they pass in core GL3. Also, using VAOs is not required in GLES2 and WebGL, but it is mandatory in GL3.
But these are GLES2 vs desktop GL differences, and not Emscripten-specific differences. See the WebGL specification for WebGL vs GLES2 differences. The most notable one is the lack of client side rendering, which engines wouldn't want to use anyways.
OK, gonna try it as it really looks like the app is being suspended in an infinite loop.
There are a few other syntax renames like this. What I do is I author my shaders in the old GLES2 syntax, and then when building for desktop, just use naive string replaces at startup time to convert the shaders so they pass in core GL3. Also, using VAOs is not required in GLES2 and WebGL, but it is mandatory in GL3.
If the desktop GL you are running on supports one of the
ARB_ES[23]_compatibility extensions, which is quite common, you
can use #version 100 (GLSL ES 1.00) shaders. Just make sure the
first line is "#version 100".
Regards
-Mark
NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.