Reputation: 9381
I am trying to understand the meaning of a "performance tip" given in the GCW Zero OpenGL instructions:
- always use vertex buffer objects (VBOs)
- put vertices into one interleaved VBO, not multiple VBOs
Does this mean that I should put ALL MY OBJECTS into a single vertex buffer (and remember the start / finish index pertaining to each object). Or does it simply mean that each object should be in one vertex buffer (rather than a buffer for each attribute).
Is it normal to have multiple objects in the same vertex buffer?
Upvotes: 1
Views: 184
Reputation: 45322
Does this mean that I should put ALL MY OBJECTS into a single vertex buffer (and remember the start / finish index pertaining to each object) Or does it simply mean that each object should be in one vertex buffer (rather than a buffer for each attribute).
This "performance tip" says nothing about multiple objects. What it says is that you should put all the attributes into the same VBO, using interleaved attribute arrays. Which is likely to be the most cache efficient strategy, and a reasonable advice in the general case.
Putting multiple objects is also quite common, especially if they have only relatively few vertices. You can save a lot of state switches and ideally even draw calls that way. But it depends on the scene, of course. Combining things into the same VBO is most useful for static objects which are often drawn together.
Upvotes: 3