   Vertex Arrays + Textures
  Hi. First time to this forum, so if I am asking a question that has been asked umpteen berdillion times, I appologize ahead of time. =)I am writing a OpenGL based 3D engine. I am using indexed vertex arrays. I am wondering how to do this while texture mapping. I didn''t see any type of indexed texture coordinte arry function or anything like that. If anyone knows of a demo on this site that does it, or can give me some sort of explanation, I would really appreciate it. Thank you.  
  I am kind of busy so I will keep this short,1- Sort you polygons into texture / texture-material order i.e. group all common textured polygons together2- Then bind the current texture, draw all polygons with this texture.3- Repeat 2 until you have drawn all polygonsI presume you know how to use vertex arrays, Note take a look at GL_EXT_compiled_vertex_array you might find this useful.Happy Coding 3DGEdited by - 3DG on April 17, 2001 1:20:08 PM  ;I think he was asking for the command to activate texcoord vertex arrays.thats: glEnableClientState( GL_TEXTURE_COORD_ARRAY ) to activate the texcoord array, and glTexCoordPointer to specify the array''s attribute and pointer.Commands like glDrawElements will now also reference the texcoord array.;  Yeah, what I am looking for is how to get textures on objects when you use something like:glDrawElements(GL_TRIANGLES, TriCount, GL_UNSIGNED_INT, pTriBuffer);I can get the object drawn, but with no way to give OpenGL an array with the texture coordinates, how does it know how to map a bound texture to the poly''s. =);  Check out the function:void glTexCoordPointer(  GLint size,  GLenum type,  GLsizei stride,  const GLvoid *pointer);... this is where you specify your array of tex-coords... happy happy joy joy ;  Hi AllI should read the post more carefully sorry, if you need info about OpenGL functions then click on the Red and Blue Book Links on NeHe’s base page. Or buy the books they are both very handy especially the blue one. Happy Coding 3DG;  What this all boils down to is that I am writing a parser for .obj format 3d object files. The way they store the data is for each object in the file, then is a array of vertices, normals, and texture coordinates. When the file defines a tri or quad, it uses indexes into the 3 above tables. ex:13/45/61 24/1/68 1/45/90 200/31/23Each grouping is a corner of a tri or quad, and each of the 3 numbers in each grouping is an index into this objects vertices, texture vertices, and normals.Easy enough, but OpenGL allows indexes into a normal, and vertices table. From what I have seen, it does not allow indexes into a texture coordinates table. If that is the case, then I need to rewrite some code to deal with that. I was hoping there was a function call in OpenGL I could use for indexing into a texture coordinate array.The .obj file format happily mixes tris and quads in 1 object, so right now I have 2 sets of indexes. 1 for tris, and 1 for quads. So I need to do this:glDrawElements(GL_TRIANGLES, TriCount, GL_UNSIGNED_INT, pTriBuffer);glDrawElements(GL_QUADS, QuadCount, GL_UNSIGNED_INT, pQuadBuffer);If there is a function to allow for indexes into a texture coordinate array, then I would have a call just before each of the following like:SomeTextureIndexFunction(pTriTextureCoordIndexes);glDrawElements(GL_TRIANGLES, TriCount, GL_UNSIGNED_INT, pTriBuffer);SomeTextureIndexFunction(pQuadTextureCoordIndexes);glDrawElements(GL_QUADS, QuadCount, GL_UNSIGNED_INT, pQuadBuffer);I could leave the file format the size it is now, and create the texture coordinates table for each object on the fly, but that means extra memory for the tables.;  Just going to bump this up to the top to see if any last help is forthcoming. =);  yes, as anon + bad monkey pointed out above.    http://members.xoom.com/myBollux  ;  Under this same topic, how do store with the vertex arrays, the normals for the polygons they represent?  