I am an university students studying computer science at the moment. Recently I finished a course on computer graphic so I want to start writing things up.
Right now I am implementing a camera for a first person view which should have the following options:
*Foward, backward
*Strafe left, right
*look up,down,left,right
*fly up, down
As a newbie at this stuff ofcouse I did go search how do people do this and I come across three methods:
Method 1
glTranslatef(cam.pos.x, cam.pos.y, cam.pos.z);
glRotate(cam.rot.x, cam.rot.y, cam.rot.z);
Method 2
gluLookAt(
cam.pos.x,
cam.pos.y,
cam.pos.z,
cam.pos.x + cam.dir.x,
cam.pos.y + cam.dir.y,
cam.pos.z + cam.dir.z,
cam.up.x, cam.up.y, cam.up.z
)
Method 3
gluLookAt(
cam.pos.x,
cam.pos.y,
cam.pos.z,
cam.look.x,
cam.look.y,
cam.look.z,
cam.up.x, cam.up.y, cam.up.z
)
Now here is my question, which one is better (in term of efficiency), from what i found methods 3 is most common but also more complicated. everyone’s implementation is different and it really give me headache to understand all of them.
please give a bright light to a newbie that want to learn
thanks in advance