Sign in to follow this  
eeenvyyy

how to align a quad to the screen

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

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