Hi !
// Define the viewport, origin will be in
// the lower left corner and the viewport
// will use up all of the window, we tell
// OpenGL to use all of the window area to
// render output into.
glViewport (0, 0, w, h);
// Select projection matrix mode, all matrix
// operations will modify the projection
// matrix
glMatrixMode (GL_PROJECTION);
// Load the projection matrix with an
// identity or unit matrix, this is a matrix
// that does not do anything at all, like
// 1234*1 will still be 1234
glLoadIdentity ();
// We want a perspective projection with a
// view angle of 65 degrees, a smaller
// angler will “zoom” in because a smaller
// area will be displayed in the viewport.
// We set the aspect ratio to w/h, this
// will make sure the a quad that has the
// same width as height will look square.
// The 2.0 is the near clipping plane,
// anything that is closer to the viewer
// then 2.0 will be clipped away, same thing
// with 20.0 but this is the far clipping
// plane, anything beyond that point is
// clipped.
gluPerspective(65.0, (GLfloat) w/(GLfloat) h, 2.0, 20.0);
// Switch to modeview matrix mode.
glMatrixMode(GL_MODELVIEW);
// Load it with an identity matrix.
glLoadIdentity();
// Translate the coordinate system 5
// points along the Z axis.
glTranslatef (0.0, 0.0, -5.0);
Thats it, remember that you cannot move the camera in OpenGL, the camera is always at
0,0,0 looking down the Z axis, so to move things you have to transform the objects instead.
If you have a peek at the FAQ on this website I think you will be able to find lots of useful stuff.
Mikael