PDA

View Full Version : Multiple objects in a VBO or Multiple VBOs?



Kreed
08-28-2012, 02:44 PM
So, I am trying to figure out the best way to draw all of my objects. Should I have multiple objects in a single VBO, or should I have a VBO per object? It seems like having a VBO per object is the better route, but how do I do this in conjunction with passing my MVP per model to the GPU and not have a draw call per object? The way I understand it, if everything is in one VBO, theoretically, I can use glDrawRange and just draw each object and then pass the MVP before each new object, but wouldn't that still be multiple Draw calls? Is there a way to only do a couple Draw calls and render ~50 (very simple) objects whilst having to send a new MVP for every new object? I could be vastly over-thinking this :doh:.

carsten neumann
08-30-2012, 08:34 AM
For 50 simple objects do whatever is easiest to code, on contemporary hardware it is unlikely to make much of a difference (for your scenario - for many more objects or more complicated objects this can make a difference).

Kreed
08-30-2012, 11:16 AM
Well, even though my first tests are small, it may likely get much larger. I am just trying to learn the best-practices. From what I have seen, it seems like storing everything in a single VBO, then passing in a TBO with indices and my matrices for each set of indices is the way to go. Does this make sense? If so, do you know any good sources or tutorials on this?

Thanks,
Kreed

carsten neumann
08-30-2012, 04:04 PM
One downside of the single VBO approach is that you can not easily remove objects: you either end up with holes or need to move possibly large amounts of data around to fill them. For static geometry that may not be an issue though. Personally I'd still use a VBO per object until profiling shows that it is a bottleneck - premature optimization and all that... ;)

Kreed
09-04-2012, 11:42 AM
Thanks for the input. I decided to go with a VBO per object. They are just small quads and there will only be ~150 on screen during the most hectic of times. Unfortunately, now im having other issues, but such is life.