Currently, I have a collection of RenderObject
classes which contains a texture, a VAO and a VBO. Drawing thousands of these objects incurs a performance penalty due to all the state switching and calls to glDrawArrays
with small numbers of triangles.
So now I'm going to change my implementation so that I create a series of 1MiB VBOs (start with one, once it gets full, create a second 1MiB VBO and continue to fill that). Do I need a separate VAO for each VBO? The VBO already uses interleaved vertex data, so I'm not talking about using multiple VBOs for vertices, normals, texture coords, etc.
I think there may be some confusion. Vertex Attribs refers to the number of per vertex elements you can pass in with a single vertex (normals would be one, UVs another, etc). In your implementation, that is limited to 16 which you are most likely not going to exceed.
VAOs store the state information required to issue a single draw call. This includes storing which VBOs need to be bound for that call. Given that each VBO must be drawn in it's own separate draw call I would also think you need a VAO to store setup info for each.
Here is a good explanation:
http://ogldev.atspace.co.uk/www/tutorial32/tutorial32.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With