Binding multiple VBOs in one call

Hi there,

I have about 400 VBOs - half contain colour data and the other half contain vertex data. When it comes to drawing this using glDrawArrays, my frame rate is reduced to about 40fps. If I eliminate the glDrawArrays call then my frame rate is back up to 60fps. Thus I think that I have a problem given the number of times glDrawArrays gets called (200 * 60 frames per second = 12,000 times per second).

I’m thinking that an obvious thing would be to consolidate the VBOs into just two i.e. one for colour data and the other for the vertex data. I could then use glMultiDrawArrays to pick out the multiple offsets and counts to draw from those 2 VBOs. However my present individual VBOs come and go (they represent flight paths) so I’d have to cater for this with the new VBO strategy.

Ideally, given the way my data is structured, it would be great to do something like this:

GLuint vertexBuffers[200];
glGenBuffers(1, &vertexBuffers[0]);


glBindBuffers(GL_ARRAY_BUFFER, vertexBuffers);
// (note the intended glBindBuffers as opposed to glBindBuffer).


glMultiDrawArrays(…)

i.e. have a means of binding multiple buffers through re-direction.

Is this somehow possible or will I need to re-structure things to use the two VBOs mentioned? Thanks for any help.

Cheers,
-C

There is no glBindBuffers.
400 VBOs is a lot. I’m sure your VBO’s are 100KB. Make some 2 or 4MB VBOs.
Use glDrawRangeElements if possible. Put the indices in a index BO.

Put the color and vertex in the same VBO.
struct vertex
{
float x, y, z
DWORD color;
float padding[4];
}

padding is for making it a multiple of 32 bytes.

Thanks for your reply. I’ve now bitten the bullet and allocate/manage a couple of larger VBOs and then use glMultiDrawArrays. I’m now getting the framerate that I seek.

AFAIK there’s no performance advantage to combining my colour and vertex VBOs is there? I maintain them separately as they are updated at different rates with the vertex one possibly never changing.

If it’s necessary to keep them separate, like if you want to modify color and keep vertex static, then it should be ok to keep them separate.