Game Development Reference
In-Depth Information
Figure 4.6 Using OpenGL textures.
void CWGLExampleDlg::DrawCube()
{
//Draw textrued faces
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
// front
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f,0.0f);
glVertex3f(-10.0f, -10.0f, 10.0f);
glTexCoord2f(0.0f,0.0f);
glVertex3f(10.0f, -10.0f, 10.0f);
glTexCoord2f(0.0f,1.0f);
glVertex3f(10.0f, 10.0f, 10.0f);
glTexCoord2f(1.0f,1.0f);
glVertex3f(-10.0f, 10.0f, 10.0f);
// back
glTexCoord2f(0.0f,1.0f);
glVertex3f(10.0f, -10.0f, -10.0f);
glTexCoord2f(1.0f,1.0f);
glVertex3f(-10.0f, -10.0f, -10.0f);
Search Nedrilad ::




Custom Search