View Full Version : About VBO mapping...

12-11-2003, 02:40 PM
In my quest to optimize I read NVIDIA's paper regarding VBOs.
There, one can read: "The “glVertexArray” function does a lot of setup in VBO, so to avoid redundancy, avoid calling it."

so, if I were to do:

//first pass


//other passes

In the last case, where the drawing occurs, the binding explicit changes the pointers offsets?
If not, does binding make previous offset undefined?

In my actuall code I have two passes, where the offsets remain the samed from one pass to another and even for diferent VBOs during thoose passes. Then I figured that maybe the offsets in the second pass where doing nothing. I commented them and everything got screwed... Why? I can't see any reason to, unless glBindBufferARB makes any previous indicated offsets invalid witch, after reading the ARB_vertex_buffer_object spec, seems wrong to me...

I would like very much for things to work like I wrote above... But it doesn't seem that way.

[This message has been edited by KRONOS (edited 12-11-2003).]

12-11-2003, 09:25 PM
You'll want to look at section 2.8A.1 of the VBO spec (http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt) . The second paragraph explains what you're seeing. Basically, calling VertexPointer and friends uses both the offset specified to the function call and the currently bound vertex buffer so set the data source. That's why VertexPointer is so costly to call. Calling BindBuffer will usually only set an internal pointer and a flag that is later used by VertexPointer.

For optimal performance on the Nvidia drivers, you want to put all of your data into the same buffers. That is, all of your vertex data should be in one buffer, all of your normal data should be one buffer (possibly the same buffer as the vertex data), etc. That may or may not be convenient for the way you have your data organized.