In most first person perspective games, the mouse is used for looking around, which only requires two angles. Each angle being taken from scaled mouse coordinates, or by scaling the number of mickeys since the mouse was last checked. The scale is determined by the in game mouse sensitivity you have selected. Something like this for example:
yaw=2PIsensitivity*(mouse.x-center.x)
or
yaw+=sensitivity*mickeys.x
[This message has been edited by DFrey (edited 09-04-2001).]
You can’t directly. That was just an example. To use that with gluLookAt you also need the pitch angle which you get from the y axis. Note that the pitch is normally limited to only 0 to PI radians, whereas the yaw goes the full 2PI radians. That pair of angles uniquely specify a point on a unit sphere. Its that point on the unit sphere that you need to pass to gluLookAt after offsetting it with the view position. Something like:
Where r is the view position, and view is the point on the unit sphere. Also in this case, you can’t look either directly straight up or down so pitch would need to be limited to 0 < min_pitch <= pitch <= max_pitch < PI.
hey gallero…
why do u use glulookat?
the easiest and best thing to move cam (is in my eyes) to move the scene against the direction!
so its very easy to realize any think like HL movin!
goto nehe.gamedev.net…
there is an demo how to do this with straving and mouselook!
its very simple…believe me!
(i think glulookat does the same to move it into the other direction)
well, MofuX i guess thats very simple really…
but with glulookat i can fix the camera target and move it around looking at target… and i guess using glrotate i have to make too much math!!
thats my weak point…
Using gluLookAt is absolutely fine. There is nothing what so ever wrong with using it. It does the same thing that moving the world vertices manually does. In the past it was a bad idea to use gluLookAt because the 3dfx mini-gl did not support any of the glu functions. But now all major video cards have a full ICD so the glu functions are supported.