OpenGL glMultiDrawElementsIndirect with Interleaved Buffers

我是研究僧i 提交于 2019-12-05 16:15:56
//Indirect data
commands[index].firstVertex     = mesh->elementOffset();

//Direct draw call
reinterpret_cast<GLvoid*>(mesh->elementOffset()),

That's not how it works for indirect rendering. The firstVertex is not a byte offset; it's the first vertex index. So you have to divide the byte offset by the size of the index to compute firstVertex:

commands[index].firstVertex     = mesh->elementOffset() / sizeof(GLuint);

The result of that should be a whole number. If it wasn't, then you were doing unaligned reads, which probably hurt your performance. So fix that ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!