Single IBO and Single VBO or terrain rendering

I think and hope I am close to having this worked out, but I am not able to render the whole terrain correctly? I think I have it narrowed down to this

glVertexPointer(3, GL_FLOAT, vertexStride, BUFFER_OFFSET(0));

the glVertexPointer() I need to somehow offset the BUFFER_OFFSET()

I have tried this

index = 0;
//loop here
glVertexPointer(3, GL_FLOAT, vertexStride, BUFFER_OFFSET(index)); glDrawElements(GL_TRIANGLES, numberIndices, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
index +=vertexStride;

but that doesn’t work either??? I only get partially rendered terrain???


How big is your terrain? If you’re using GL_UNSIGNED_SHORT, then the largest terrain you can have is 255 x 255. You can’t have anything bigger. Try using GL_UNSIGNED_INT instead if you can.

I am trying to use unsigned short to stay on the fast path as Nvidia suggests.

I am sure there is some way to use a single VBO and a single IBO and just offset the various pointers to render the mesh?

a IBO of say 33x33 patch size is well with in unsigned short range. I have a working unsigned int version, but that uses one large VBO with many many IBO’s…

This looks wrong. Surely your indices and your vertex data don’t live at the start of the same buffer?

This are different buffers. DrawElements takes the currently bound ekement array buffer, while *Pointer takes the vertex array buffer.

Right, thanks for the correction. Slipped my mind.