Skip to main content
gamedev.net
🔒 Locked

Texturing Indexed Geometry

Started by enigmatix 1 reply 600+ views
Original Post
enigmatix
enigmatix
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?
Promit
Promit
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
enigmatix
enigmatix
Thanks a lot. That was pretty quick! :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.