how to make front drawn first???
Code: Select all
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef( 0.0f,0.0f,-6.0f); // Move back And Into The Screen 6.0
glRotatef( trans, 1.0f, 5.0f, 2.5f);
//front
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glColor3f(1.0f,0.0f, 0.0f); // Font
glVertex3f( -1.0f, 1.0f, -1.0f); // Top left
glVertex3f( -1.0f, -1.0f, -1.0f); // bottomleft
glVertex3f( 1.0f, -1.0f, -1.0f); // bottomright
glVertex3f( 1.0f, 1.0f, -1.0f); // topright
glVertex3f( -1.0f, 1.0f, -1.0f); // topleft
glVertex3f( 1.0f, -1.0f, -1.0f);
//BACK
glColor3f(0.0f,1.0f, 0.0f); // Font
glVertex3f( 1.0f, -1.0f, 1.0f); // bottomright
glVertex3f( -1.0f, -1.0f, 1.0f); // bottomleft
glVertex3f( -1.0f, 1.0f, 1.0f); // Top left
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f( -1.0f, 1.0f, 1.0f); // topleft
glVertex3f( 1.0f, 1.0f, 1.0f); // topright
//TOP
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f( -1.0f, 1.0f, 1.0f);
glVertex3f( -1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glEnd();
trans += 0.05f;
return TRUE; // Everything Went OK
}