Jump to content
  • Advertisement
Sign in to follow this  
Erik Sintorn

Per face texture coords and vertex arrays?

This topic is 4702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Allright, thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!