Im trying to create a first person camera, and I've been successful in understanding how to do so thus far. I've read up on alot of vector math and matrix stuff and I know the basics. Although I got a few problems when I try to implement it into my code.
I have 3 main vectors, which are position, direction and up. I am trying to use
glTranslatef(x, y, z);
to update my camera-position, but Im not a 100% sure on what values I want to update it with. If I keep updating with my position vector, like so:
glTranslatef(position.x, position.y, position.z);
I will keep moving in one direction, even if im not pressing any buttons. (Moving in the direction that the results of all three values in the position vector will be.) I've been able to work around this by using
glLoadIdentity();
In the main loop, before I do all the translating. Is this the correct way of doing it? Or do I add another vector and translate with that one? Im a bit of a perfectionst, and I want to do it correctly the first time. So I don't have to relearn!
Thanks! I hope im clear enough on what my problem is, I'll be happy to post my sourcecode if you really need it, I felt like it was a bit unnecessary though.