You didn't answer my first question fully. How do I calculate the up vector from the direction vector(from eye - focus point) and the roll angle? I knowyou just can ignore it and just let it be y up. But I want to have it. If the roll is 0 then the up vector shall be (0,1,0) as a reference.
How do I calcuale it if the roll angle is in degrees?
As for the second question, I found its answer elsewhere.
Main Topics
Browse All Topics





by: ikeworkPosted on 2009-08-27 at 23:46:48ID: 25205429
Hi AntonKarlsson,
>> how do I calculate the up vector from the viewing direction vector and camera/view roll?
If you just want a normal camera, then you dont need to calculate it, its just {0.0, 1.0, 0.0}
Only if you want to have a camera-shake effect or something, then you need to calculate it accordingly.
>> how do I call the gluLookAt and place all scene-objects locations(with the basic gl translation functions)? And when to call glLoadIdentity()?
In the beginning of your render function you reset the matrix-stack with glLoadIdentity.
Then you call gluLookAt and after that you render your objects.
If you want to reset the camera and all previous matrix-stack changes, then you can call glLoadIdentity. But usually you jst need to call it in the beginning of your render function, before gluLookAt
ike