Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ OpenGL gluLookAt help

Tags:

c++

opengl

I have been attempting to use gluLookAt but i have come across some issues...my first is what is the default position of the camera, whenever i try to use it, my whole scene seems to rotate sideways and up.... my second question is....from what i have read it is gluLookAt(Posx,Posy,PosZ,yaw,pitch,roll,then three up vectors)

but what order is yaw pitch and roll suppose to be in?

Solved
the default position of the camera is at gluLookAt(0, 0, 0, 0, 0,-1, 0, 1, 0); Thanks Drew for all your help :D

like image 837
I Phantasm I Avatar asked May 07 '11 03:05

I Phantasm I


1 Answers

You seem to have gotten some bad information about the arguments to gluLookAt(). From the OpenGL 2.1 online documentation, the arguments should be as follows:

eyeX, eyeY, eyeZ:
  World coordinates of camera location

centerX, centerY, centerZ:
  World coordinates of camera aimpoint (what it's looking at).
  This point will be in the center of the resulting image, assuming
  that it lies between the near & far clip planes.

upX, upY, upZ:
  A vector (preferrably orthogonal to the line of sight) that specifies the
  roll orientation of the camera (that is, which way is "up" in the image).

As you can see, there is no explicit mention of pitch, roll, or yaw.

Also, by default, the camera is at (0, 0, -1) if I recall correctly--but it doesn't matter since you'll almost always call gluLookAt with the modelview matrix set to the identity.

like image 61
Drew Hall Avatar answered Nov 12 '22 04:11

Drew Hall