I have recently upgraded to opengl 4.5 and have picked up the super bible. While going through it I noticed there were some super nice ways to add buffers to VAO. ie glVertexArrayVertexBuffer. I am wondering if there is a similar pattern to bind a index buffer to the VAO and have it automaticlly use it when calling glDrawElements or if I have to remember to bind the index buffer before each call to the glDrawElements. I read the wiki and it seems to give me the belief that VAO’s can store index buffers and use them but I can’t figure out how.
glVertexArrayElementBuffer
sets the EBO for a specific VAO. Prior to the addition of the DSA interfaces, you’d just bind the VAO then bind the EBO to GL_ELEMENT_ARRAY_BUFFER
. That specific binding is VAO state rather than context state.
Talking from opengl 3.3 I seem to recall a surprise fo find that the start of a serie of draw-calls needs to bind to the program, the VAO, but also the VBO (and its attribs) and the IBO. That’s what I do in working code where I expected to bind less (ei just the VAO).
That would only happen if you did your VAO setup wrong.
Had a suspision that my code-ajustments were a bit quick. I certainly will have a second look. The drawing is of low complexity, so everything looks & feels ok.
I hope that I hit the gist of what @McRaeAlex was asking.
Thank you, this is exactly what I was looking for. I must have missed it in reading into OpenGL.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.