I'm trying to implement a first person movement system using GLUT and OpenGL. So far I have the strafing left to right, and forward/backward movement working correctly. However, my problem comes with the looking around. I want to be able to use the movement of the mouse to look around, like most/all FPS games. I'm using gluLookAt for all of my movement/looking around. Currently, for the looking around section, I have this (taken from a tutorial)
gluLookAt(position.x, position.y, position.z,
position.x + direction.x, position.y + direction.y, position.z + direction.z,
up_vector.x, up_vector.y, up_vector.z);
Then for when there is a passive mouse movement, I check for it and do this:
horizontal_angle += 0.005* float(x - origin_x);
vertical_angle += 0.005* float(y - origin_y);
direction_vector.x = cos(vertical_angle) * sin(horizontal_angle);
direction_vector.y = sin(vertical_angle);
direction_vector.z = cos(vertical_angle) * cos(horizontal_angle);
position.x = sin(horizontal_angle - 3.14f/2.0f);
position.y = 0.0f;
position.z = cos(horizontal_angle - 3.14f/2.0f);
up_vector = crossProduct(right_vector, direction_vector);
However, this is giving me some really weird, wobbly effect, not particularly close to the one I want.