I am seeing a strange problem with glTexCoordPointer() but can’t seem to determine what is going on. I think I have some GL wrong but its acting like a compiler problem not addressing the arrays correctly. This is being built on a Linux system.
I have a cube texture mapped with a textute that spins, just to text mipmapping. The vertexes are in one array of 8 vertexes.
One versiopn that works correctly has the texture verts in a single array, one per vertex. This produces some interesting patterns but I know why. (one per vertex = not good). The indicies are in a single array, 24 long, to draw the object.
This all works well.
NOW…
Break up the texture verts into six arrays each with an s/t for each vertex.
Break up the INDICES into six arrays each with 4 values.
Then instead of one call to glTexCoordPointer & glDrawElements…
I call the each six times in sucession, (glTexCoordPointer & glDrawElements), to draw the model. The first panel texture is placed OK…All other panels have textures coordinates all messed up.
I’m sure the data is ok because if I expand to a loop and use (glBegin(),glTexCoord2f(),glVertex3i(),glEnd()) the model draws correctly.
Anyone seen this???
BTW…Vertex array is funky incase anyone catches it (int)(id,x,y,z)
----CODE SNIPPET FOR ARRAYS----
void Draw(void)
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(Model.location.x, Model.location.y, -Model.location.z);
glRotated(Model.angle.z, 0.0, 0.0, 1.0);
glRotated(Model.angle.x, 1.0, 0.0, 0.0);
glRotated(Model.angle.y, 0.0, 1.0, 0.0);
glVertexPointer(3, GL_INT, 16, (GLvoid*)((int)g_cube_vertices + sizeof(int)));
/* Draw model using single call to arrays */
// glTexCoordPointer(2, GL_SHORT, 0, g_cube_texverts);
// glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, g_cube_indices);
/* Draw model using multiple calls to arrays */
glTexCoordPointer(2, GL_SHORT, 0, sidea_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sidea_indices);
glTexCoordPointer(2, GL_SHORT, 0, sideb_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sideb_indices);
glTexCoordPointer(2, GL_SHORT, 0, sidec_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sidec_indices);
glTexCoordPointer(2, GL_SHORT, 0, sided_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sided_indices);
glTexCoordPointer(2, GL_SHORT, 0, sidee_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sidee_indices);
glTexCoordPointer(2, GL_SHORT, 0, sidef_txverts);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, sidef_indices);
glFlush();
glutSwapBuffers();
}