Advertisement

gluLookAt

Started by April 12, 2002 07:59 AM
4 comments, last by cerberus07 22 years, 10 months ago
I have recently written a function to rotate the camera using vectors and gluLookAt. My problem is that i can''t even get gluLookAt to work. When i enter something like gluLookAt(0.0f, 2.0f, -5.0f, 0.0f, 2.0f, -4.0f, 0.0f, 1.0f, 0.0f), the camera does not move from (0.0f, 0.0f, 0.0f), why would this be?
Do you have the modelview matrix selected?

Are you calling loading an identity matrix before glLookat each frame?

Are you ever loading an identity again afterwards that frame?
Advertisement
The camera doesnt move because in opengl the camera CANT move. Its always at origin 0,0,0 and everything else moves around the camera.

It may sound wierd at first, but after a while its very easy to code for, and isnt bad at all.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Maximus: That is only if you want to look at it that way. Conceptually, moving the "camera" is exactly gluLookAt does.

cerberus07: How are you using gluLookAt? Perhaps you're doing things in the wrong order.

Try this:
while(!done)
{
clear scene
load identity matrix
gluLookAt
render geometry
}

Jesse

Edit: I can't type today.

[edited by - Jesse Chounard on April 12, 2002 12:45:50 PM]
dont worry i worked it out, i don''t know why it didn''t work before
quote:
Original post by Jesse Chounard
Maximus: That is only if you want to look at it that way.


If you look at it anyway, OpenGL has no "camera". It is a fixed view point at all times, and cannot be moved. It can be made to look as if its moving by moving the world around the zero vector.

gluLookAt isnt an OpenGL function, its a utility function which isnt actually a part of OpenGL. It makes calls to proper OGL functions internally to move the world around 0,0,0.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack

This topic is closed to new replies.

Advertisement