PDA

View Full Version : VBO performance



CRasterImage
10-26-2012, 10:03 AM
I have a situation where there are 3 million points. Broken up among 255 thousand separate entities. (GL_LINE_STRIP, GL_TRIANGLE_STRIP, etc..)

I have created 255 thousand VBOs. One for each entity.
The performance is the same as if I had simply done glBegin() vert, vert, vert, glEnd(). (which sends all 3 million points from CPU to GPU on every draw)

Is having the data broken up into so many separate VBOs the performance problem?

Should I make a single, giant VBO and draw each entity using an offset into that?

Other theories?

malexander
10-26-2012, 11:40 AM
Is having the data broken up into so many separate VBOs the performance problem?

Yes.

There is a lot of driver intervention going on there, causing a great deal of drawing overhead. You're drawing roughly 12 vertices per draw call, so your gl function calls are becoming a very large bottleneck.

You don't need to create one huge VBO if it's not convenient, but I wouldn't create much more than 100 for this case. Try grouping your lines and triangles together so that you can draw a large number at once. If you need to change GL state often, such as the color, consider using a VBO for the color changes instead. For things you can't place in VBOs, like texture changes or line changes, try grouping those primitives with the same state together so that you can minimize GL state changes.