They are achieved by applying a series of glTranslate, glRotate commands (which represent camera position and orientation) before drawing the scene. (technically, you rotate the whole scene!)
There are utility functions such as gluLookAt that sort some details about this.
To simplify things, suppose you have two vectors representing your camera: position and direction.
gluLookAt takes position, destination and vector up.
If you are implementing a vector class, destinaion = position + direction should indicate the destination.
Again, to make things simple, you can assume that the up vector is always (0,1,0)
Then, before rendering anything in your scene, load the identification matrix and call gluLookAt
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( source.x, source.y, source.z, destination.x, destination.y, destination.z, 0, 1, 0 );
Then start drawing objects
You can let the user skip by slightly changing the position to the right or left. Rotating is a bit trickier as you need to rotate the direction vector. Assuming you're spinning, this is a camera, not some object in the scene.
One of the problems is that you only have a forward direction vector, how do you move it? where are the right and left?
My approach in this case is to simply take the cross product of the “direction” and (0,1,0).
Now you can move the camera left and right using something like:
position = position + right * amount;
You can move forward using the "direction vector", but IMO is better to limit the movement to a horizontal plane, so get the vector forward just like we got the correct vector:
forward = cross( up, right )
Honestly, this is a somewhat hacky approach.
The right approach is to use a more “complex” data structure to represent the “orientation” of the camera, not just the front direction. However, since you're just getting started, it's good to do things one at a time.