Jump to content
  • Advertisement
Sign in to follow this  
_nomad_

how to create my own gluLookAt?

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

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

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!