Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


gluLookAt Convert To glRotatef / glTranslatef


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 PsyVision   Members   -  Reputation: 130

Like
Likes
Like

Posted 19 July 2001 - 06:48 AM

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.

Sponsor:

#2 Obelix   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 July 2001 - 08:06 AM

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.





#3 brettporter   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 July 2001 - 12:43 PM

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


#4 PsyVision   Members   -  Reputation: 130

Like
Likes
Like

Posted 03 August 2001 - 06:33 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS