Sign in to follow this  

how to create my own gluLookAt?

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

Quote:
Original post by _nomad_
anyone here knows how glulookat works? is it possible to do what glulookat is doing by just pure glrotate and gltranslate?


Yep, and yep - but you'll get gimbal lock.

gluLookAt uses the inverse of a standard "frame" matrix, so:


[ Sx Sy Sz -Px ]
[ Ux Uy Uz -Py ]
[ Fx Fy Fz -Pz ]
[ 0 0 0 1 ]


Where, S, U, F and P are the side, up, front and position vectors of the camera respectively.

Load this into the modelview matrix before anything, and it'll transform the scene to around the camera.

Share this post


Link to post
Share on other sites
Quote:
Original post by _nomad_
hmm...so if I load that up to the modelview matrix before anything, i will not get gimbal lock? Thanks.


why would you not just use gluLookAt?

-me

Share this post


Link to post
Share on other sites
Quote:
Original post by Palidine
Quote:
Original post by _nomad_
hmm...so if I load that up to the modelview matrix before anything, i will not get gimbal lock? Thanks.


why would you not just use gluLookAt?

-me


Because of the way it works? It wants a point 1 unit along the front vector, instead of just the front vector. That seems a little pointless to me, considering I have to calculate that point from the front vector in the first place, and all gluLookAt does is calculate the front vector from that point again.

I point you to This thread.

Share this post


Link to post
Share on other sites

This topic is 4831 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.

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