Jump to content
  • Advertisement
Sign in to follow this  
razor1911

gluProject to UV coordinates

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

The thing is,
i have my 3d coords converted to 2D window coordinates,
but i need them to be UV-like coords where we start from -1 and end at 1.

Kinda in hurry, i seem not to imagine how do i convert my 2d window coordinates to obtain UV range coords.

[source lang=cpp]
#define GAME_X 1024
#define GAME_Y 768

//windowcoords obtained from gluProject


//Below this will give me a values from 0 to 1
WORLD.sun_position2D.x=windowcoords.x/GAME_X;
WORLD.sun_position2D.y=windowcoords.y/GAME_Y;





Can someone please shed a bit of light on this ?

Share this post


Link to post
Share on other sites
Advertisement
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!