I'm trying to use a single VAO to represent a single VBO that contains multiple meshes. Right now I have:
glVertexArrayElementBuffer ( vertexArray, buffer );
glVertexArrayVertexBuffer ( vertexArray, positionLocation, buffer, 0, 3 * sizeof ( float ) );
glVertexArrayVertexBuffer ( vertexArray, normalLocation, buffer, (objectVertexBytes + objectIndexBytes), 3 * sizeof ( float ) ); // Issue 2
More of the source here: http://pastebin.com/PDuk3fDu
I think my problem resides mainly in the last line of the snippet.
I thought I could stuff two dissimilar meshes in the same VBO? How is that possible if I can only set the state for seemingly one when setting up the buffer sources?
I'm going through this trouble because I read that having a single VAO for each VBO is horribly inefficient due to the fact that binding is a relatively expensive thing to do. I also read that storing meshes with similar needs in the same VBO is a good idea.