#### Archived

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

# gluLookAt Problem

This topic is 5924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I''ve recently been trying to learn 3d programming, and I''ve got a problem that I haven''t been able to work around for weeks. I have a camera. Moving it around is no problem. I can move it forward and backward, strafe, and rotate with the mouse. I''m using quaternions for rotation, so I know my problem isn''t Gimbal Lock. When I''m rotating with the mouse, I get a problem when the Z Direction of the camera should equal/cross over the Z Position of the camera. In this instance, the image starts to mirror itself wildly and I can''t move the camera any further in that direction. I think I''ve traced the problem to the gluLookAt function and the Up Vector. I''ve tried changing the Up Vector to solve the problem (changing it from 0,1,0 to 0,-1,0 in certain instances), but the solution does not work flawlessly. I''ve also tried changing the way I handle my camera via not using gluLookAt and instead using glTranslate and glMultMatrixf with a rotation matrix. However, I haven''t really been able to get this approach to produce realistic looking results. I was hoping someone would know the solution to my problem or be able to point me in the right direction toward making a realistic looking camera with translations and matrix multiplications. Thanks, --Nairb

##### Share on other sites
The problem with gluLookAt is that when you look past the up vector, i.e., your looking behind you, everything will be upside down. So then the the view gets rotated around too keep up pointing up, rather than down. You essentially face the opposite direction instantly. If you continue to look up, you will look past this again it will again flip. That can be very annoying, jerky, and disorienting.

You probably don''t need 6 degrees of freedom, and can get away with using the x position of the mouse to rotate around the x/z plane, and the y position to rotate that around the x/y plane.

##### Share on other sites
Hello Nairb,

I''ve great interest in your mouse moviment code. can you send me?

Thanks a lot!

Daniel Vivas

##### Share on other sites
Don''t there exist alternatives to gnuLookAt then?

I''m just working with OpenGL cameras too and I''d like to have it as much freedom as my Raytracer''s camera!

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 10
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632922
• Total Posts
3009223
• ### Who's Online (See full list)

There are no registered users currently online

×