It is convenient to create a 1-to-1 correspondence between VBO’s and rigid objects within the system I have: When an object is created, I initialize its very own VBO (or VBO/IBO pair) to store the geometry needed for rendering it, which will be static. When the object is destroyed or no longer needed, cleanup is simply a matter of deleting the associated buffers.
This is in contrast to representing my geometric data for multiple objects across a single VBO: cleanup for a removed object will be very troublesome.
The reason why I might prefer putting multiple geometries into one VBO is that I can draw everything in a VBO using a single draw call.
Consider the situation in a 2D game engine where there are very many non-identical small objects which are free to move around. I’d like to avoid the overhead of changing the bound VBO for every single object while rendering them.
Is there any mechanism in place to address this “issue”? I’m looking for something like a glMultiDraw but allowing me to specify on which buffers to draw my primitives from.
What do you suggest I do to deal with this? The best solution I have thought of so far is to treat my big meshes separately from my small meshes: The small ones I can transform on the CPU each frame, and assemble a STREAM_DRAW VBO that has all of them. For my larger meshes I manage a VBO for each. After all, I’m just trying to limit the number of state changing gl calls rather than minimize them.
The proper way of course is to transform in the vertex shader. I could use a uniform array filled with transformation matrices, and use a vertex attribute indicate which transformation to apply. I’d still want to re-assemble the VBO if I am modifying it, though.
I just think that it could be beneficial in some situations to have a feature that allows drawing from multiple buffers, and I’m wondering if something like that will show up in later versions.