I believe I have found a bug in the GLES 2 emulation code.

When calling glGetVertexAttribiv (and friends) with GLES2 emulation 
enabled, the client buffer for the given index is checked, and if enabled, 
an error message is printed that the operation is not supported.

I get this message even for VBO attribute arrays, because 
in glEnableVertexAttribArray, the client buffer is always set to enabled 
without checking if it's actually a client-side array or not.

I think the fix is for glGetVertexAttribiv to check for the clientside 
field instead of the enabled field, which is conditionally set in 
glVertexAttribPointer.

e.g.

https://github.com/kripken/emscripten/blob/master/src/library_gl.js#L1505
glGetVertexAttribiv: function(index, pname, params) {
#if FULL_ES2
    if (GL.currentContext.clientBuffers[index].enabled) {
      Module.printErr("glGetVertexAttribiv on client-side array: not 
supported, bad data returned");
    }
#endif

and

https://github.com/kripken/emscripten/blob/master/src/library_gl.js#L5632
glEnableVertexAttribArray: function(index) {
#if FULL_ES2
    var cb = GL.currentContext.clientBuffers[index];
#if ASSERTIONS
    assert(cb, index);
#endif
    cb.enabled = true;
#endif

I'm happy to send in a pull request for this, but wanted to check with you 
first to see if I am on the right track.  I am new to Open GL programming.

Thank you!

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