When to use gl*Pointer with VBO

I am writing an application that uses vertex buffer objects. I ran into a crash when I called gl*Pointer() before glBindBuffer() on the data (didn’t crash then, only when I called glDrawElements).

The idea was that if I had a large number of batches using the exact same vertex format, I could call gl*Pointer() once before drawing the batches, then calling glBindBuffer once for each batch. However it looks like I will have to set the pointers up for each batch, even if I keep calling them with the exact same parameters.

Is there anyway to do what I want? Or are the gl*Pointer calls lightweight enough that it is not really an issue (on a 6800U anyway)?

When you do a glPointer call, it uses the bound VBO. If you change the bound VBO, it will continue to use the VBO that was bound when you called glPointer. The reason for this is obvious; otherwise, you couldn’t pull vertex data from multiple VBOs.