Sign in to follow this  
lack the hack

texture polygons?

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by lack the hack
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:)


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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this