Archived

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

Crispy

texture mapping

Recommended Posts

Crispy    556
I used to use a well-defined sequence pattern to texture map my faces which included a lot of experimenting (I now see what a horrible thing I was doing in retrospect). Then I wrote loaders for a few other image formats besides the bitmap and everything blew up in my face. Now my huge project is pretty much in disarray and I need to work out a standard. For different texture types different mapping sequences seem logical so I can''t really decide which order to choose. And yes, I do understand that by defining the order in which texture coordinates are set also defines the orientation of the face''s normal. 1] 1 2 3 4 2] 4 3 1 2 3] 1 4 2 3 4] 2 3 1 4 Cheers

Share this post


Link to post
Share on other sites
Crispy    556
I''d simply like to know in what order most people pass texture coordinates down the video pipeline - clockwise or counter-clockwise, and starting where (in a face with 4-corners, the upper or lower edge). It''s as simple as that really. Since I can''t imagine which one could turn out more difficult to keep in mind (for whatever reason), I''d much rather rely on others'' experience.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Huh?

Each vertex you issue has a texture coordinate. Thus, you pass texture coordinates in the same order as you pass the vertices. Read the documentation for glDrawElements(), glVertexPointer() and glTexCoordPointer() for more enlightenment.

Share this post


Link to post
Share on other sites
Crispy    556
Okay, I know that. The question here is, what happens if you pass four vertexes that make up a quad clockwise and counter-clockwise down the pipeline. If culling is enabled the face will end up either visible from a certain point or not. Furthermore, by starting from either of the bottom two vertexes (for a quad) with no manually defined texture coordinates, you''ll end up with the face (or rather the texture) being mapped upside down. It is therefore essential to know in which order to draw your vertexes/set the texture coordinates unless you''re loading a some file that contains these texture coordinates (such as as bsp file). I don''t have that luxury right now so I have to figure out how to make all of the faces look normal, uniformly aligned texture-wise and culled at the same. I ran into a brainlock, but I think I''ve got it figured out now. Using arrays is not really feasible in this case since I have very few faces (< 10).

Share this post


Link to post
Share on other sites
theZapper    150
It''s quite confusing understanding what you''re trying to say! but it''s generally a good idea to specify vertex co-ordinates and texture co-ordinates in the same order, CCW is the preferred way in computer graphics.

"When I''m in command, every mission''s a suicide mission" - Zapp Branigan

Share this post


Link to post
Share on other sites