Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture coordinates

Started by aziii Nov 19, 2009 at 8:00 AM 3 replies 750+ views
Original Post
aziii
aziii
I made a basic mesh loader, which loads vertices, normals and indices from a file. Next I'm going to add support for textures. But I render the model with glDrawElements. Each index in the index array passed to glDrawElements is used for all arrays (normal/vertex/color/uv). So how to have unique UV coordinates for each face without using immediate mode? What's the point textures if faces must share the same UV coordinates?
szecs
szecs
Sadly you have to split up the vertexes, that have unique (u,v) pairs.
So you will have 2-3-4-etc vertexes in the same place.
You have to to the same, if the normals are unique (So the mesh can have smoothing groups, thus sharp edges and flat faces too)

I hope it makes sense
aziii
aziii
All faces got unique UV coordinates, but they all share the same normals & vertexes. Is there any way to have unique UV coordinates for each face without duplicating lots of data?
Brother Bob
Brother Bob
Two vertices that share position and normal, but not texture coordinates, are not the same, so you cannot share them. You must duplicate the position and normal attributes for those vertices so you can assign the unique texture coordinate to each of the duplicates.
dpadam450
dpadam450
It has been this way for a long time. Splitting is the only way.
NBA2K, Madden, Maneater, Killing Floor, Sims 

Topic Locked

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

Sign in to reply to this topic.