> On Apr 2, 2015, at 5:19 AM, Sergey Kurdakov <[email protected]> wrote:
> 
> Hi,
> 
> I started to update my port of osg to emscripten 
> 
> and I have following questions ( though I will resolve them by manual header 
> file change, the questions seems of interest to others ).
> 
> as far as I understand, library_gl.js replaces
> 
> gl calls in  C code by name. 
> 
> Now,there are few special cases when  functions are available via 
> library_gl.js 
> but cannot be found in  OpenGL ES header files supplied with EMSCRIPTEN.
> 
> say
> 
> https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2ext.h
>  
> <https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2ext.h>
> 
> declares 
> GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, 
> GLsizei, GLenum, GLsizei, GLsizei);
> 
> and there is 
> 
> glRenderbufferStorageMultisample in library_gl.js
> 
> if someone  has a C program with glRenderbufferStorageMultisampleIMG   this 
> call will not be mapped ( though internally this function will be used by 
> WebGL), but if someone uses 
> glRenderbufferStorageMultisample it will be ok.
> but  
> glRenderbufferStorageMultisample is declared in gl/gl.h
> 
> but mixing gl/gl.h and  GLES2 gl2.h/gl2ext.h headers might cause conflicts.
> 
> there are other combinations. 
> 
> say glBlitFramebuffer is in
> 
> https://github.com/kripken/emscripten/blob/master/src/library_gl.js 
> <https://github.com/kripken/emscripten/blob/master/src/library_gl.js>
> 
> but there is no corresponding function declared in 
> 
> https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2ext.h
>  
> <https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2ext.h>
>  or 
> https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2.h 
> <https://github.com/kripken/emscripten/blob/master/system/include/GLES2/gl2.h>
> 
> ( this function appears in ES 3.0/webgl 2.0 but I do not see guards against 
> it's use with WebGL 1.0 code, and else l glBlitFramebufferANGLE exists in 
> ANGLE but it's not declared at all in above two files)
> 
> so it will be nice to have a standard approach in described situation  - when 
> there is an available webgl function which is possible to use in OpenGL ES 
> 2.0 in ANGLE based application ( it's nice to debug at desctop prior to 
> compiling code to emscripten ), but there is no  straightforward way to 
> 'compile' into valid webgl code without changing stock header files and no
>  additional  information is provided 
> at 
> http://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-support-webgl-subset
>  
> <http://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-support-webgl-subset>
>  
> 

GL/gl.h is for desktop OpenGL. GLES2/gl2.h & GLES2/gl2ext.h are for OpenGL ES. 
gl.h and gl2.h/gl2ext.h should not be mixed. They are for different, but 
similar, APIs.

Functions with suffices (IMG, ANGLE, etc.) are extensions to OpenGL ES. Similar 
functionality is often available in core desktop OpenGL using the same function 
name without the suffix.

The correct way to use extensions in OpenGL ES 2 is to get the extensions 
string via glGetString(GL_EXTENSIONS) and search it for the name of the 
extension of interest. If found, it means the implementation supports that 
extension. You then use eglGetProcAddr to get pointers to the extension 
functions and use those pointers to call the functions. 

I do not know which of the extensions you have mentioned are supported by 
Emscripten’s OpenGL ES emulation.

Regards

   -Mark

-- 
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.

Reply via email to