   Quake-style texturing? (Certain coords. from a texture map)
  Hey there. I was wondering about how Quake does the texturing for the palyer models, etc. I mean, in the book "Beginning Direct3D Game Programming", it has a sample texture/model, in .MD2 format. In the texture, it has the head, body, etc. How do they get the correct texture coordinates in order to place them on the model the way the do?If you need a more specific question/information, just let me know.Thanks in advance,Matt U. 
  texel coordinates from a loaded texture are selected by (u, v), best thought of as an alternate (x, y) reference, where u and v are between 0 and 1.  1 indicates the far edge of the texture.  So, if the model's head image is in the lower left quarter of the texture, you would use texCoords (0, 0), (0.25, 0), (0.25, 0.25), (0, 0.25).  Reasons : the complete texture must have dimensions of a power of 2 ( eg 256 X 256 ), and thus your texture is usually not of these exact dimensions.  Also, by putting muliple images onto a single texture, you don't have to swap textures by glBindTexture(.. ), which is apparently an expensive operation.*edit* pardon my openGL context above   [edited by - squirrel_of_death on February 11, 2004 11:44:51 PM];  The texture mapping are done i a 3d program like 3dstudio or what ever. And the texturecoordinates har stored in the exported .MD2file. So every modell is created to use specific texture layout.Not the other way around. ;  Thank you both for your input. Squirrel_of_death, I had an idea that that''s how it was done, but I was just asking to make myself sure.Well, here''s an example situation. If I had a cube that was of size "1.0f" all the way around, would these be the correct texture coordinates if I had a 256x256 image?: // The texture layout    ---   |   ||¯¯¯¯| ----   |   |   |   |    ¯¯¯Are these the correct coords (for the front face of the cube)?Front Face:Top-left= (0.25, 0.25)Top-right    = (0.75, 0.25)Bottom-right = (0.75, 0.75)Bottom-left  = (0.25, 0.75)I am not sure, but I may be wrong. If so, could you give me the coordinates? If those are wrong and I see the correct set, I am sure I will understand it then. =)Thanks for the help,Matt U. ;  It''s up to your MD2 loader/renderer how it finds the right part of the texture for the front face, but for you the best way to get the idea is to just try it yourself.  Make a simple image, put it at some area in a 256X256 texture, then calculate the coordinates yourself.  When you get your image perfectly on a rendered Quad / Triangle (keep it simple), you will know you got the right idea. ;  Alright, thanks for the information. I''ll start on that when I start working on some more projects. =) 