I am porting a game engine that works perfectly on different platforms (Windows, iOS, Playbook, BB10, Android) to NaCl
2d renders correctly but some 3d Objects don't show or are rendered really strange and i get the following con
[.PPAPIContext]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : BackTexture::AllocateStorage: <- error from previous GL command (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: stride not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: offset not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0 (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: stride not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: offset not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: stride not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: offset not valid for type (index):1
[.PPAPIContext]GL ERROR :GL_INVALID_OPERATION : glVertexAttribPointer: stride not valid for type
And it repeats indefinitely.
Again, the same render code is used for different platforms and it works just fine. Is there a special consideration to be taken into account when porting to NaCl? Any ideas about what i should focus on to try find the issue? As far as i can understand, there's a problem with the shader 0 (the vertex shader) and indeed the vertices of some objects are all over the place.
Thanks! :)
For security reasons, Chrome validates many GL operations that other drivers may not. It's a bit of work, but you might try searching the Chromium codebase using http://cs.chromium.org to find the error messages.
Here's what I found:
BackTexture::AllocateStorage: <- error from previous GL command
This one is tricky to follow. As it says, some previous GL command failed before BackTexture::AllocateStorage
was called. I looked through the rest of the file, and it's not clear to me what command is failing here, but from the error value it is framebuffer related.
glVertexAttribPointer: stride not valid for type and glVertexAttribPointer: offset not valid for type
These are pretty clear -- the stride and offset values are not divisible by the component size. It would be useful to see your calls to glVertexAttribPointer
.
glDrawElements: attempt to access out of range vertices in attribute 0
VertexAttrib::CanAccess
is failing, which checks whether the attrib is enabled, not deleted, and if the vertex index that you're trying to access is valid. As the error says, you are likely referencing a vertex outside of the valid range.
To debug this, I'd narrow down the calls to glDrawElements
and glVertexAttribPointer
and try to find which one is failing, then I'd add some printf
calls to see what values are being passed.
Good luck!