Per face texture coords and vertex arrays?

Started by
1 comment, last by GameDev.net 18 years, 7 months ago
Hello. When creating an object in 3d studio and texturing it with UVWunwrap, so that one texture (containing several images) is used for the whole object, each vertex no longer has one texturecoord but the coords must be saved per-face. For example:


            x
           /|\           
          / | \         
         /  |  \ 
        /   |   \        
       /    |    \      
      /     |     \     
     / Wall | Roof \    
    x-------x-------x

The left triangle will need three texturecoords from the wall part of the texture and the right one will need three coords from the roof part of the texture. Now, my problem is, How can I when drawing the faces with glDrawElements give texturecoords on a per-face basis? I suppose I could build a huge vertex array instead and use glDrawArrays, but then I will lose all the benefits of caching vertice? How is this usually done? Thank you. Erik
Advertisement
You would need to be able to define seperate indices for vertex position and texture coordinates. Unfortunately, there's no such feature. A vertex is a solid entity, containing all attributes(position,texcoords,color...) and is being indexed by one number. All you can do is split the vertices.
Allright, thanks.

This topic is closed to new replies.

Advertisement