Here's what going on..
Anvil.obj ->
Code: Select all
1 Texture
50 Faces
150 Verts (vec3)
150 Normals (vec3)
150 TexCoords (vec2)
Code: Select all
#define BUFFER_OFFSET(i) ((char*)NULL + (i))
The data is used sizeof(float)*3 by default I think.
Code: Select all
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(OffsetPosition));
glNormalPointer(GL_FLOAT, 0, BUFFER_OFFSET(OffsetNormal));
glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(OffsetTexcoord));
Code snippet for this fail->
Here I added data padding sizeof(float)*4 which, seemed to fix things a little?! But it's still messed up.
Code: Select all
glVertexPointer(3, GL_FLOAT, 16, BUFFER_OFFSET(OffsetPosition));
glNormalPointer(GL_FLOAT, 16, BUFFER_OFFSET(OffsetNormal));
glTexCoordPointer(2, GL_FLOAT, 16, BUFFER_OFFSET(OffsetTexcoord));