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. On Mar 8, 2014 5:00 PM, "Michael IV" <[email protected]> wrote: > Ok,so let me see if I get you right.I can basically use GLEW with GL 3.0 - > GL 3.2 core profile and it will be translated ok (except of GLSL compat > issues) to WebGL?Also,in terms of context creation,I see I can use GLFW or > GLUT ? > > > On Sat, Mar 8, 2014 at 4:56 PM, Jukka Jylänki <[email protected]> wrote: > >> 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 >> On Mar 8, 2014 4:42 PM, "Michael IV" <[email protected]> wrote: >> >>> 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 [email protected]. >>> >>> 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 >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Michael Ivanov > Independent Pixel Commander > onlygraphix.com > Tel:+972 54 4962254 > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
