Quote:Original post by AxoDosS
I forgot to point out on the post at CG Talk that you should specify the data type (GL_FLOAT, GL_INT...etc) in your glVertexPointer and glNormalPointer functions. GL_TRIANGLES is a primitive type and not a data type.
Wow, good call AxoDosS. That was silly of me.
Ok, so it no longer crashes but when I switch to the VBO, the whole object goes to hell. It draws somewhat like it should, only the triangles are all scrambled. In other words, it looks like it's drawing to the right vertices, just not at all in the right order. Well, I shouldn't even say it's drawing to the right vertices as there is one vertex out in the middle of no where that thousands of triangles are binding to.
The first problem, the scrambled triangles binding to appropriate, but misordered vertices, suggests there's a problem with the index list. The second, the random vertex out in the middle of no where, would suggest there's a problem with the vertex list. I've been staring at this thing for 2 hours now and I can't see what I'm doing wrong.
I've checked the index list, it matches perfectly with the one used to draw the object using a display list (which works properly). It has the same number of elements and (as near as I can tell, there are thousands) the same values. The list of vertices is the exact same as the one that the display lists draw from, so I doubt there's a problem there.
Here is what I have so far:
setup:
pglGenBuffersARB(2, buffList); pglBindBufferARB(GL_ARRAY_BUFFER_ARB, buffList[0]);eglBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(*vertlist) * numVerts, vertList, GL_STATIC_DRAW);pglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffList[1]);pglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(*index) * numInd, index, GL_STATIC_DRAW);
render:
pglBindBufferARB(GL_ARRAY_BUFFER_ARB, buffList[0]);glNormalPointer(GL_FLOAT, 0, BUFFER_OFFSET(0));glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(12));pglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffList[1]);pglDrawRangeElements(GL_TRIANGLES, 0, numVerts-1, numInd, GL_UNSIGNED_INT, BUFFER_OFFSET(0));
I'm completely clueless as to what's going wrong here. I've checked just about all of the values I'm passing to the VBO, but if there's anything I should pay special attention to, I'd be happy to double (or rather triple) check anything.
Thanks for everyone's help, thus far. This is driving me crazy.
Without order nothing can exist - without chaos nothing can evolve.