I've been trying stuff like this in an initialization routine. My confusion is clear in the code.
Code:
glViewport(0, 0, window.getwidth(), window.getheight());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//
// Look down at scene at right angle
// Account for rectangularness of window w/ aspect
// Set near clip 1 unit away from camera
// Set far clip 200 unit away from camera
//
gluPerspective
(M_PI / 2, float(window.getwidth()) /
float(window.getheight()), 1.0f, 200.0f);\
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//
// Camera position at (0, 0, 20)
// Looking at (0, 0, 0)
// And the direction of up is (0, 1, 0)
gluLookAt(0, 0, 20, 0, 0, 0, 0, 1, 0);
//
// Wierd trial and error finds that things won't render unless
// the translate is there, and that I switch back to the projection
// matrix.
//
glTranslatef(0, 0, 20);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
Things are a few rectangles at z = 0.