Jump to content
  • Advertisement
Sign in to follow this  
enigmatix

Texturing Indexed Geometry

This topic is 4140 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

I'm wondering how you would go about setting texture coordinates for geometry that makes use of an index buffer. Say you have a grid of 4 quads. With an index buffer, any vertices being shared by the quads will not only share position, but also texture coordinates. 0----1----2 |--/-|--/-| |-/--|-/--| 3----4----5 |--/-|--/-| |-/--|-/--| 6----7----8 If the top left quad's texture coordinates are: p0: (0,0) p1: (1,0) p3: (0,1) p4: (1,1) Then you are left having to start from the ends of the texture. This would result in texture flipping. Should I just keep incrementing the end value, so 0-1, 1-2, 2-3 or is there a more appropriate way to deal with this?

Share this post


Link to post
Share on other sites
Advertisement
When you're using indexed vertices, the shared vertices need to be identical. In particular, note that this is not the same as having identical positions. Tex coords and all other attributes need to be the same too.

In this case, though, you can let the texture coordinate keep increasing, and use the wrap address mode, so 0 = 1 = 2 etc as far as what gets sampled.

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!