PDA

View Full Version : When to use gl*Pointer with VBO



gdewan
12-01-2004, 11:16 AM
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)?

Korval
12-01-2004, 11:52 AM
When you do a gl*Pointer 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 gl*Pointer. The reason for this is obvious; otherwise, you couldn't pull vertex data from multiple VBOs.