VBO: gl*Pointer invalid after dereferencing?

Hi,

in order to speed up the vertexbuffer wrapper we use i tried to reduce the calls to glPointer as suggested by the nvidia whitepaper on VBOs. But seems that it isn’t sufficient to do the offset setup via the glPointer calls once for a VBO.
When doing multipass rendering with VBO, do i have to re-setup the VBO memory via gl*Pointer?
Do the offsets become invalid after dereferencing/rendering?

regards,
Stephan

Code please.
glPointer needs to be called to associate a vertex attribute array with a VBO. Means if you have called glBindBuffer for the first time you have not associated any glPointer with that buffer and must call glPointer to set offsets into that buffer.
If you have multiple VBOs, offsets are not reassociated until you call gl
Pointer.
This is designed that way to be able to use multiple VBOs to store different vertex attribute arrays. E.g. you can keep the static ones in a different buffer that way and only update the data in the dynamic attrib array.

[This message has been edited by Relic (edited 01-16-2004).]

Originally posted by Relic:
[b]Code please.
glPointer needs to be called to associate a vertex attribute array with a VBO. Means if you have called glBindBuffer for the first time you have not associated any glPointer with that buffer and must call gl*Pointer to set offsets into that buffer.

ok. that’s obvious.

If you have multiple VBOs, offsets are not reassociated until you call gl*Pointer.
This is designed that way to be able to use multiple VBOs to store different vertex attribute arrays. E.g. you can keep the static ones in a different buffer that way and only update the data in the dynamic attrib array.[/b]

That means, since the offset are not associated to the bound buffer, the offsets are valid as long as i don’t bind a new buffer?

The offsets are accociated with the buffer that was bound with the offsets were defined. My terrain renderer, for example, uses two buffers: one that contains texture coordinates and 2d vertex coordinates (representing the x and y coordinates of each point on the terrain), and another buffer that contains the height value for each vertex (stored as a 1d texture coordinate), the vertex colours, and the vertex normals. (The 2d vertex coordinate is combined with the height value in the a vertex program.) The first buffer needs only to be bound and the offsets defined once each frame, regardless of how many consecutive terrain segments I render.