Using Index vertex arrays with Tex Coords

Hey,
just trying to teach myself how to use indexed vertex arrays but im encountering problems assigning tex coords to each vertex when using indexes and a vertex array …a coord is applied to each vertex…but not for each face…only the base vertices before they are run through by the indexing.

i think i know where your problem is, but if you use indexed vertexarray you only get one texcoordpair (using glTexCoordPointer and enabling GL_TEXTURE_COORD_ARRAY), per vertex, so you cannot use different texcoords per face, by using glDrawElements! To get independent texcoords, you should draw like(disable texcoord_array):

per vertex in face(3 times):

  1. set texcoords by yourself
  2. call glArrayElement(index);

that defeats the purpose of using the vertex array i think.