0Could you please help me out with this scenario: I have a 3D world, and I want to position the camera in a first-person manner( the real purpose would be a first-person view from inside a spaceship, while travelling through an asteroid belt). What would be the parameters for glulookat in this case? I thought of:
gluLookAt(30, 30, 30, 0, 0, 0, 0, 1, 0);//the up vector would be normal y axis
Would this be correct?
Also if I want the camera to move along with the ship, how would that be done? When moving the ship I should also move the “eye” coordinates from glulookat? Something like the eye coordinates(the first 3 parametres of glulookat) should be the same with the ship coordinates?
The gluLookAt call you propose would position the camera at
(30,30,30)and point it at the origin.This is more like what you need. You’ll have to call it every frame so that the camera will follow the ship’s movement. If you want the ship to do a barrel roll, you’ll have to have additional variables to track the up vector.
I like to have some kind of struct to hold co-ordinates so that I can overload gl functions to take them and write shorter function calls, e.g.