gluLookAt Problem
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
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.
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.
Hello Nairb,
I''ve great interest in your mouse moviment code. can you send me?
Thanks a lot!
Daniel Vivas
I''ve great interest in your mouse moviment code. can you send me?
Thanks a lot!
Daniel Vivas
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!
I''m just working with OpenGL cameras too and I''d like to have it as much freedom as my Raytracer''s camera!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement