| void
MyWindow::DrawCube(){
 glBegin(GL_QUADS);
 // front
 glNormal3f(0, 0, 1);
 glColor3f(1, 0, 0);
 glVertex3f(-1, 1, 1);
 glVertex3f(-1, -1, 1);
 glVertex3f(1, -1, 1);
 glVertex3f(1, 1, 1);
 
 // back
 glNormal3f(0, 0, -1);
 glColor3f(0, 1, 0);
 glVertex3f(-1, 1, -1);
 glVertex3f(1, 1, -1);
 glVertex3f(1, -1, -1);
 glVertex3f(-1, -1, -1);
 
 // top
 glNormal3f(0, 1, 0);
 glColor3f(0, 0, 1);
 glVertex3f(-1, 1, -1);
 glVertex3f(-1, 1, 1);
 glVertex3f(1, 1, 1);
 glVertex3f(1, 1, -1);
 
 // bottom
 glNormal3f(0, -1, 0);
 glColor3f(1, 1, 0);
 glVertex3f(-1, -1, -1);
 glVertex3f(1, -1, -1);
 glVertex3f(1, -1, 1);
 glVertex3f(-1, -1, 1);
 
 // left
 glNormal3f(-1, 0, 0);
 glColor3f(0, 1, 1);
 glVertex3f(-1, 1, -1);
 glVertex3f(-1, -1, -1);
 glVertex3f(-1, -1, 1);
 glVertex3f(-1, 1, 1);
 
 // right
 glNormal3f(1, 0, 0);
 glColor3f(1, 0, 1);
 glVertex3f(1, 1, 1);
 glVertex3f(1, -1, 1);
 glVertex3f(1, -1, -1);
 glVertex3f(1, 1, -1);
 glEnd();
 }
 |