VAO & binding multiple VBOS

Hey

I wonder if its possible to


{
  Bind VAO.
  bind VBO_vertexA;
  bind VBO_vertexB;
  bind VBO_vertexC;
  bind VBO_vertexD;

  bind VBO_indicesA;
  bind VBO_indicesB;
  bind VBO_indicesC;
  bind VBO_indicesD;

  bind VBO_normalsA;
  bind VBO_normalsB;
  bind VBO_normalsC;
  bind VBO_normalsD;
  Release VAO
}

{
  Bind VAO
  draw(VBO_vertexA meshes)
  draw(VBO_vertexB meshes)
}

etc etc? So I can have multiple vbos under 1 VAO that are vertex/indices/uvs/normals and then draw each of them 1 by 1 or something like that? I would like to glDrawElementsBaseVertex on each VBO and provide a uniform matrix/flags per each set of vertex that I would like to draw.

A VAO stores the current GL_ELEMENT_ARRAY_BUFFER binding, plus the state associated with each attribute array.

Calling glBindBuffer(GL_ARRAY_BUFFER) doesn’t itself change the VAO state. A call to glVertexAttribPointer() stores the buffer currently bound to GL_ARRAY_BUFFER, along with its parameters.

So if you have a sequence of calls like:


glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, buffer_0);
glVertexAttribPointer(0, ...);
glBindBuffer(GL_ARRAY_BUFFER, buffer_1);
glVertexAttribPointer(1, ...);
...
glBindVertexArray(0);

it will store the buffers associated with each attribute. If you have multiple glVertexAttribPointer() calls which all use the same attribute index, each one will overwrite the state set by the previous call for that index, leaving the state set by the last such call. You can’t store multiple element arrays.