Opengl es 2.0 NaCl GL错误:GL\u无效\u操作

Opengl es 2.0 NaCl GL错误:GL\u无效\u操作,opengl-es-2.0,google-nativeclient,Opengl Es 2.0,Google Nativeclient,我正在将一个可以在不同平台(Windows、iOS、Playbook、BB10、Android)上完美运行的游戏引擎移植到NaCl 2d渲染正确,但有些3d对象不显示或渲染非常奇怪,我得到以下结论 [.PPAPIContext]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : BackTexture::AllocateStorage: <- error from previous GL command (index):1 [.PPAPIContext

我正在将一个可以在不同平台(Windows、iOS、Playbook、BB10、Android)上完美运行的游戏引擎移植到NaCl

2d渲染正确,但有些3d对象不显示或渲染非常奇怪,我得到以下结论

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

[.PPAPIContext]GL错误:GL\u无效\u帧缓冲区\u操作:BackTexture::AllocateStrage:出于安全原因,Chrome验证了许多其他驱动程序可能无法验证的GL操作。这需要做一点工作,但是您可以尝试使用搜索Chromium代码库来查找错误消息

以下是我的发现:

  • 这些都很清楚——跨距和偏移值不能被组件大小整除。查看对
    glvertexattributepointer
    的调用会很有用

  • 失败,这将检查属性是否已启用而不是已删除,以及您尝试访问的顶点索引是否有效。正如错误所说,您可能引用的顶点超出了有效范围

为了调试它,我缩小了对
gldrawerelements
glvertexattributepointer
的调用范围,并尝试找出哪一个失败,然后添加一些
printf
调用以查看传递了哪些值


祝你好运

您可能会遇到这样一种情况,即您的平台的固有数据类型在大小上与GL typedefs不同<例如,code>GLushort
保证始终为16位,而C中的
无符号short
则不是。如果您列出了调用
glvertexattributepointer(…)
等时使用的代码,这会有所帮助。