I cannot get this quad to draw unless I have it’s Z coordinates set to > -1.0f. I have the near and far plane set to 0.1 and 100, and it shows up if I use -1.0f as the Z coordinates, but not if I go less then that.
I have a valid device context, valid opengl rendering context, etc…
This is how I setup the projection matrix:
if (!h) {
h = 1;
}
glViewport (0, 0, w, h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (60, (float)w/(float)h, 0.1f, 100.0f);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
And this is how I draw:
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0, 0, -6.0f);
glBegin (GL_QUADS);
glVertex3f (0.5f, -0.5f, 0.0f);
glVertex3f (0.5f, 0.5f, 0.0f);
glVertex3f (-0.5f, 0.5f, 0.0f);
glVertex3f (-0.5f, -0.5f, 0.0f);
glEnd ();
SwapBuffers (r_context);