0

So, when I want to change vbos, I have to do the glVertexAttribPointer for every single draw call, but for vaos, I only have to bind them, and nothing else, the glVertexAttribPointer thing I do only once, outside the main loop. Everywhere I look I see that vaos are only the vertex format, but then, why do I need to specify glVertexAttribPointer every time, if i'm using different vbo and same vao, its just repeating code in loop.

So, how would you loop through the draw loop,

like this:

bind vao
for each vbo
{
     glattribpointers
     glEnableVertexAttribPointerArray
     draw elements
}

Or like this:

for each vao
{
     bind vao
     draw elements
}

First option seems to do unnecessary functions, and second makes me think vaos are pointless

BDL
  • 18,169
  • 14
  • 45
  • 47
  • 1
    Why is in the second code sample the vao pointless? They store which buffers are bound to which shader attribute. You might be interested in [OpenGL VAO best practices](https://stackoverflow.com/questions/8923174/opengl-vao-best-practices) – BDL Jun 05 '20 at 10:55

0 Answers0