• Advertisement

Archived

This topic is now archived and is closed to further replies.

Index Buffers and Texture Co-ordinates

This topic is 5101 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 trying to render some stuff with index buffers and have a little trouble with them. The problem is that the texture co-ordinates always seem to get messed up. When I render a cube, the mapping appears fine on the top and bottom faces, but all the side faces get kinda skewed, like applying a planar map. The texture co-ordinates seem to be messed. How do I rectify this? I would also like to know how to handle models where the number of texture co-ordinates exceeds that of the vertices. For example, models exported from the popular modelling packages usually have more texture co-ordinates than vertices, so how does one deal with this? Thanks

Share this post


Link to post
Share on other sites
Advertisement
The problem is, you can''t have multiple texture coordinates per vertex of your cube.

You have to duplicate your vertices for each face. Using indicies only makes sense when you have surface meshes, not something like a cube (which is like one of the worst case scenarios for index buffers.)

Just make 4 vertices per 6 faces, and it will work. No way around it.

Share this post


Link to post
Share on other sites
Thanks man. I guess now I''ll have to build my vertices based on texture coordinates, making a unique vertex for each texture co-ordinate rather than simply 8 vertices for a cube. Thanks again.

Share this post


Link to post
Share on other sites

  • Advertisement