Multiple Buffer Objects or not?

Hello all,

I have a design question about Buffer Objects in openGL.
When having a large application with some classes of objects that would share similar fate, like say get updated together or drawn together while other classes would get drawn more infrequently which of the following is better?

  1. Bind one large VBO and one large IBO for all the objects in your application. Then try to update them moving the buffers around to accomodate for objects whose vertices got deleted.
  2. Bind as many VBO/IBO combinations as needed by the different classes of objects your application requires so that you have the ability to update/draw/delete them without messing with the vertices of the other classes of objects.

My naive guess is the second choice but I would just like to check with people in here. Would that be the correct choice? Or is there even a third option?

Tendencies here are to say to bind as less as possible.

But as usual I think all depends on many things :slight_smile:

If you mean with “try to update them” to upload/remove/move data in the buffer, I think this won’t be a good idea, because uploading process has a price. If it’s just to move into the array indices, then it can be a better idea.

Hey arts, thanks for the reply.

What I mean by moving around is simple. Imagine many objects all having indices in an IBO pointing to vertices on a VBO.

Each object draws itself by knowing the index and size of the part of the IBO that corresponds to it. All is well.

But at the deletion of one or more objects all data inside the IBO and VBO would need to be moved to cover the deleted space so that graphics memory is not wasted. And all indices should be updated accordingly.

I am debating with myself what is better. Doing that or just having many VBO and IBO pairs so that when you delete one or mroe objects you just scrap the corresponding VBO-IBO pair and you don’t need to worry about updating the indices of all the other objects of the application?

Hard to say. It depends. If you have huge amount of data and parts of it change often (ie deletion and then new data), you can try to use a single vbo and change the data. And if deletion is very rare, the same. But if almost all your data will be deleted at some time, then maybe many vbo will be better (ie dynamic draw vbo).

All depends on your needs, and make tries should help you find out the best solution to your needs, even if sometimes, it’s not easy to change the codes to make tests.

Use the dark photons caching VBO, it’s the best thing.

It’s Rob Barris’ VBO technique. I just proposed reusing batches once on the GPU, and applying bindless to it for speeding up dispatch.

Thread links: