Jump to content
  • Advertisement
Sign in to follow this  
lack the hack

texture polygons?

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

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!