Jump to content
  • Advertisement
Sign in to follow this  
eeenvyyy

how to align a quad to the screen

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

how exactly do i align a quad to the screen? also, eventually i would like to create a gui. the only thing i'm really hung up on is the coordinate system of the screen. how would i go about making it so that the bottom left corner is (-1.0,-1.0) and the top right corner is (1.0,1.0) so that i could define a quad within that range and have it display in the correct place on the screen? i'm using opengl for this if it matters. thanks.

Share this post


Link to post
Share on other sites
Advertisement
Check the OpenGL FAQ to see how to use Ortho mode in OpenGL; this will allow you to position quads on the screen using pixel coordinates.

I'm not too sure what you would do mathematically to find coordinates of a quad that align with the screen in a parallel fashion to the view frustrum. However, I expect (and I'm no expert, believe me!) that you could simply add up all the rotations up to the point where you want to draw the parallel geometry, and then reverse them, like this pseudocode:


Rotate(XRotate, YRotate, ZRotate)
DrawSomeStuff()
Rotate(-XRotate, -YRotate, -ZRotate)
DrawParallelObjects()


This may not work though, so I'd test it if I were you :)

Share this post


Link to post
Share on other sites
wow.. ortho was what i needed. for some reason i had it in my head that you couldn't switch between perspective and ortho. thanks ill give it a try.

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!