简体   繁体   English

VBO绑定的OpenGL顺序

[英]OpenGL Order of VBO binding

If I'm trying to do some OpenGL 3.3+ style VBO graphics, is it alright for me to first, enable attribute arrays and set vertex attribute pointers, then in an often refreshing VBO, load fresh data and bind a GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER then call drawELements? 如果我想做一些OpenGL 3.3+风格的VBO图形,那么我是否可以首先启用属性数组并设置顶点属性指针,然后在经常刷新的VBO中加载新数据并绑定GL_ARRAY_BUFFER和GL_ELEMENT_ARRAY_BUFFER然后调用drawELements? I have code that is crashing on drawElements, and I'm wondering if its because the order of my calls is messed up. 我的代码在drawElements上崩溃了,我想知道是否是因为我的调用顺序混乱了。 I'll also mention that this is under the guise of Qt 5. 我还要提到这是Qt 5的幌子。

Whn you set your attribute pointers, it is crucial to have the correct GL_ARRAY_BUFFER bound. 设置属性指针时,至关重要的是要正确绑定GL_ARRAY_BUFFER The current GL_ARRAY_BUFFER_BINDING at the time of the glVertexAttribPointer() call will become part of that attribute pointer state. 调用glVertexAttribPointer()时,当前的GL_ARRAY_BUFFER_BINDING将成为该属性指针状态的一部分。 It does not matter which GL_ARRAY_BUFFER is bound at draw time (in contrast to the GL_ELEMENT_ARRAY_BUFFER which is relevant for the glDrawElements() family of GL functions. 不要紧,这GL_ARRAY_BUFFER在绘制时(相对于绑定GL_ELEMENT_ARRAY_BUFFER这是相关的glDrawElements()系列的GL功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM