VAO and GL_ELEMENT_ARRAY_BUFFER.

Started by
2 comments, last by Chris_F 9 years, 12 months ago

The OpenGL wiki has me confused here:

Index buffers

Indexed rendering, as defined above, requires an array of indices; all vertex attributes will use the same index from this index array. The index array is provided by a Buffer Object bound to the GL_ELEMENT_ARRAY_BUFFER?binding point. When a buffer is bound to GL_ELEMENT_ARRAY_BUFFER?, all rendering commands of the formgl*Draw*Elements*? will use indexes from that buffer. Indices can be unsigned bytes, unsigned shorts, or unsigned ints.


The index buffer binding is stored within the VAO. If no VAO is bound, then you cannot bind a buffer object to GL_ELEMENT_ARRAY_BUFFER?.

You CAN'T bind to GL_ELEMENT_ARRAY_BUFFER unless you have already bound a VAO?! This makes no sense to me as one would naturally want to bind to GL_ELEMENT_ARRAY_BUFFER when filling it in and not want to be worried about binding an associated VAO. Is there another way to fill an index buffer? Does having 0 bound as VAO count as having a VAO bound?

Advertisement

The GL_ELEMENT_ARRAY_BUFFER state belongs to the currently bound VAO, if no VAO is bound, then you cannot set this state. Core profile requires you to generate and bind a valid VAO, binding "0" is not an option.

VAO and GL_ELEMENT_ARRAY_BUFFER are mutually exclusive, in the sense that you don't need the other for one to work.

VAO and GL_ELEMENT_ARRAY_BUFFER are mutually exclusive, in the sense that you don't need the other for one to work.

You may not need an element array buffer to use a VAO, but you most certainly do require a VAO to use an element array buffer. The excerpt from the wiki makes that perfectly clear.

This topic is closed to new replies.

Advertisement