# texture polygons?

This topic is 4879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

is it possible to texture map on polygons? i would expect it is possible but how do you specify the texture coordinates? do you go beyond the 0 - 1 s,t range? sorry to have such annoying questions thanks guys:)

##### Share on other sites
the function is glTexCoord2fv, and yes its [0, 1].

##### Share on other sites
You can go beyond range from 0-1, and that would be for repeating puproses. Texture cooridinates (0,1) and (0,2) are basically the same. So if you have vertices:

x x x x x
x x x x x
x x x x x
x x x x x

and give them Texture coordinates

x x x x x
x x x x x
(1,0) etc... x x x
(0,0) (0,1) (0,2) (0,3) (0,4)

that would mean that you want to tile your texture 5x5, not to texture your object with whole texture once.
Hope this helps...

##### Share on other sites
the values are always between [0-1] for normal effects. if you like to map on a polygon, just load the texture in your image editing software, and then grab a path tool or something and draw your polygon inside the texture. then take the vertices coordinates and scale them to 0-1 with respect to texture's size and that's it. if you use values outside of 0-1, depending on what effect you set, opengl clamps your values to 0-1 or repeats the texture. hope it helps.

##### Share on other sites
Quote:
 Original post by lack the hackis it possible to texture map on polygons? i would expect it is possible but how do you specify the texture coordinates? do you go beyond the 0 - 1 s,t range? sorry to have such annoying questionsthanks guys:)

It seems you've misunderstood the texture coordinates slightly. :)

the texture coordinates are from
0 = First pixel of the texture in that direction
to
1 = Last pixel of the texture in that direction...

So no matter what, 0.5 will ALWAYS be in the center of the texture! :)

hope this helps!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 9
• 15
• 14
• ### Forum Statistics

• Total Topics
634070
• Total Posts
3015330
×