View Full Version : VBO Woes

03 March 2005, 10:49 PM
I'm using the OpenGL Vertex Buffer Object extension to speed up my rendering, but it's crashing for some reason. Can anybody see why?

Here is the VBO setup code:

pglGenBuffersARB(2, buffList);

pglBindBufferARB(GL_ARRAY_BUFFER_ARB, buffList[0]);

pglBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(*vertList) * numVerts, vertList,


pglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffList[1]);

pglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(*indices) * numInd, indices, GL_STATIC_DRAW);

and here is the render code:

pglBindBufferARB(GL_ARRAY_BUFFER_ARB, buffList[0]);

glNormalPointer(GL_TRIANGLES, sizeof(*vertList), BUFFER_OFFSET(0));

glVertexPointer(3, GL_TRIANGLES, sizeof(*vertList), BUFFER_OFFSET(12));

pglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffList[1]);

pglDrawRangeElements(GL_TRIANGLES, 0, numVerts-1, numInd, GL_UNSIGNED_INT, BUFFER_OFFSET(0));

The program crashes with a memory access error on the call to pglDrawRangeElements and I really can't figure out why. I check to make sure that the extension is indeed supported.

Can anybody see what I'm doing wrong?

03 March 2005, 12:27 AM
One thing might be that you are using the functions: glVertexPointer ( and glNormalPointer ( in a wrong way.

Here is how I use them when using VBO's:
glVertexPointer(3,GL_FLOAT,0,(char*)NULL); // I use (X,Y,Z) hence the value 3

03 March 2005, 02:39 AM
Doh! Now that you mention it I am using those calls wrong. I'm passing it a size, when I should be passing it a 0 since I'm using the VBOs. I'll give it a shot first thing tomorrow morning.

Thanks Axodoss!

CGTalk Moderation
03 March 2005, 02:39 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.