Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

PsyVision

gluLookAt Convert To glRotatef / glTranslatef

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

hey, I have some code that uses gluLookAt, it is from a camera class, although, for my other code that i have done i am using glRotatef and glTranslatef, i know the variables for glTranslatef, if i say that the variables i input into gluLookAt are camEye, camUp, camDir: gluLookAt(camEye.x, camEye.y, camEye.z, camUp.x, camUp.y, camUp.z, camDir.x, camDir.y, camDir.z); how can i change this so i can use glRotatef and glTranslatef ?? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I would try to calculate the roll, pitch anf heading and then use

glRotated(roll, 0.0, 0.0, 1.0);
glRotated(pitch, 0.0, 1.0, 0.0);
glRotated(heading, 1.0, 0.0, 0.0);
glTranslated(-camEye.x, -camEye.y, -camEye.z);

You can also look in Mesa how it is implemented.



Share this post


Link to post
Share on other sites
I think the roll, pitch, yaw is a completely different method of doing it though - it may not fit all situations as easily.

You can actually figure out the matrix and use glLoadMatrix or a series of rotations and translations. A 3D Math book will help out there.

I tried this when I started because I Was under the impression glu was like glut and wasn''t available everywhere. Don''t do it. Use gluLookAt - the driver will do it so much faster than you will.

~~~
Cheers!
Brett Porter
PortaLib3D : A portable 3D game/demo libary for OpenGL

Share this post


Link to post
Share on other sites
cheers for da help, i will have a play i think i can get it to work (i think i can work out the roll and stuff from what i have).

Share this post


Link to post
Share on other sites

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