glBegin ( GL_P0LYGON ); // front face
glNormal3f ( 0.0, 0.0, 1.0 ) ;
glTexCoord2f ( 0, 0 ); glVertex3f ( xl, yl, z2 );
glTexCoord2f ( 1, 0 ); glVertex3f ( x2, yl, z2 );
Основы библиотеки OpenGL
glTexCpord2f ( 1, 1 );
glVertex3f ( х2, у2, z2 );
glTexCoord2f (0,1);
glVertex3f ( xl, y2, z2 ); glEnd ();
glBegin ( GL_POLYGON ); // back face
glNormal3f (0.0,0.0,-1.0);
glTexCoord2f ( 1, 0 );
glVertex3f ( x2, yl, zl );
glTexCoord2f ( 0, 0 );
glVertex3f ( xl, yl, zl );
glTexCoord2 f ( 0, 1 );
glVertex3f ( xl, y2, zl );
glTexCoord2f ( 1, 1 );
glVertex3f ( x2, y2, zl ); glEnd ();
glBegin ( GL_POLYGON ); //left face
glNormal3f ( -1.0, 0.0, 0.0 );
glTexCoord2f ( 0, 0 );
glVertex3f ( xl, yl, zl );
glTexCoord2f ( 0, 1 );
glVertex3f ( xl, yl, z2 );
glTexCoord2 f ( 1, 1 );
glVertex3f ( xl, y2, z2 );
glTexCoord2f ( 1, 0 );
glVertex3f ( xl, y2, zl ); glEnd ();
glBegin ( GL_POLYGON ); // right face
glNormal3f ( 1.0, 0.0,0.0 );
glTexCoord2f ( 0, 1 );
glVertex3f ( x2, yl, z2 );
glTexCoord2f ( О, 0 ) ;
glVertex3f ( х2, yl, zl );
glTexCoord2f ( 1, 0 ) ;
glVertex3f ( x2, y2, zl );
glTexCoord2f ( 1, 1 ) ;
glVertex3f ( x2, y2, z2 ); glEnd ();
glBegin ( GL_POLYGON ); // top face
glNormal3f ( 0.0, 1.0, 0.0 ) ;
glTexCoord2f ( 0, 1 );
glVertex3f ( xl, y2, z2 );
glTexCoord2f ( 1, 1 ) ;
glVertex3f ( x2, y2, z2 );
glTexCoord2f ( 1, 0 ),-
glVertex3f ( x2, y2, zl );
glTexCoord2f ( 0, 0 ) ;
glVertex3f ( xl, y2, zl ); glEnd ();
glBegin ( GL_POLYGON ); // bottom face
glNormal3f ( 0.0, -1.0, 0.0 );
glTexCoord2f ( 1, 1 ) ;
glVertex3f ( x2, yl, z2 ) ;
glTexCoord2f ( 1, 0 ) ;
glVertex3f ( xl, yl, z2 );