void InitGL(int Width, int Height)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);
glDepthFunc(GL_LESS);
//glDepthFunc(GL_GREATER);
glEnable(GL_DEPTH_TEST);
}
void DrawGLScene()
{
glClear(GL_COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-1.5f,0.0f,-6.0f);
/* draw a square (quadrilateral)*/
glColor3f(0.5f,0.5f,1.0f); /* set color to a blue shade.*/
glBegin(GL_QUADS); /* start drawing a polygon (4 sided)*/
glVertex3f(-1.0f, 1.0f, 0.0f); /* Top Left*/
glVertex3f( 1.0f, 1.0f, 0.0f); /* Top Right*/
glVertex3f( 1.0f,-1.0f, 0.0f); /* Bottom Right*/
glVertex3f(-1.0f,-1.0f, 0.0f); /* Bottom Left */
glEnd(); /* done with the polygon*/
/* draw a triangle (in smooth coloring mode)*/
glTranslatef(-1.0f,0.0f,0.0f); glBegin(GL_POLYGON); /* start drawing a polygon */
glColor3f(1.0f,0.0f,0.0f); /* Set The Color To Red */
glVertex3f( 0.0f, 1.0f, -1.0f); /* Top*/
glColor3f(0.0f,1.0f,0.0f); /* Set The Color To Green*/
glVertex3f( 1.0f,-1.0f, -1.0f); /* Bottom Right*/
glColor3f(0.0f,0.0f,1.0f); /* Set The Color To Blue*/
glVertex3f(-1.0f,-1.0f, -1.0f); /* Bottom Left */
glEnd(); glutSwapBuffers();
}