PDA

View Full Version : glTexCoord2f()



jankri
07-23-2001, 09:25 AM
I have been working with textures for a while so I thought I understood what was going on. I am working on a program that textures each triangle of a surface separately... and even using the math needed, some of the triangles' textures get distorted. And yet when I assign -1 to the problem texture coordinate it all looks great. Why does passing a -1 to openGl fix the problem?

V--man
07-23-2001, 02:32 PM
I don't know but for binding textures, those are treated as positive numbers so -1 is some high number. Valid values are 1 and above for binding textures.

V-man

Rob The Bloke
07-23-2001, 02:33 PM
Imagine a quad where you wanted a single texture across the entire surface. Applying the tex coords : (0,0) to (1,1) would map the entire texture across it. Split the quad into four, and imagine the texture over all four of the quads as apposed to one,

the text coords would be (0,0) in the bottom left, (1,1) in the top right and (0.5,0.5) at the intersection of the quads.

You could however use the co-ordinates (-1,-1) in the bottom left, (0,0) in the top right and (-0.5,-0.5) at the intersection. It would give you the same results. The texture co-ordinates wrap around from -infinity to +infinity, The texture will be displayed repeated in each unit square.

This does of course presume you have the texturing set to repeat rather than clamp.... http://www.opengl.org/discussion_boards/ubb/smile.gif

jankri
07-24-2001, 04:39 AM
Yes my texturing is set to repeat. Thanks.

When I said changing the problem coordinate to -1 I did not mean that I was changing an entire coordinate pair, only the second member of the coordinate pair is changed to -1 and for some reason that helps. Any ideas?

jankri
07-24-2001, 07:41 AM
Thanks for you help... I figured out my question myself.