Jump to content
  • Advertisement
Sign in to follow this  
boldyman

texture uv

This topic is 4895 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

Hello, I have a uv coordinate question. When you texture two triangles the uv coordinates would be : 0,1 ****** 1,1 * /* * / * * / * 0,0 ****** 1,0 (By the way: i use gl_triangles and read a triangle and uv like this: x y z u v 20.0 80.0 0.0 1.0 1.0 20.0 20.0 0.0 1.0 0.0 100.0 20.0 0.0 0.0 0.0 20.0 80.0 0.0 1.0 1.0 100.0 20.0 0.0 0.0 0.0 100.0 80.0 0.0 0.0 1.0 ) This i understand. What would be the texture coordinates for a shape build of four triangles, like so: ****** * /* * / * * / * ****** * /* * / * * / * ****** I like to put the texture over the whole shape ! Is this possible and what are then the uv coordinates ???? Can someone explain this to me ? Thanx

Share this post


Link to post
Share on other sites
Advertisement
Your diagrams got a little screwed up... But I think you want to read up on UV values and why they are in the 0.0 to 1.0 range. To stretch it out over 4 triangles like you show:


0,1**********1,1
* / *
* /
0,.5*********1,.5
* / *
* / *
0,0**********1,0


The idea is pretty simple. Take the entire surface that you want the texture to be applied to. The corners of this entire surface will always be (0,0) (1,0) (1,1) (0,1). If you want the texture cordinate of any point on that surface, find how far it is (percentage) along the U and V axis. Then this value is your texture coordinate if you're going from 0 to 1.

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!