PDA

View Full Version : Texture the inside of a quad?



Swiftless
06-13-2005, 12:51 AM
In my application I am making a box to go around my world as a skybox. The only problem is, I cannot see it from inside the box. Only from the outside. To draw it I am using GL_QUADS.

The code to draw the box is:



glPushMatrix();
glBegin(GL_QUADS);
glVertex3f( 256.0f, 256.0f, 256.0f);
glVertex3f( 256.0f,-256.0f, 256.0f);
glVertex3f( 256.0f,-256.0f,-256.0f);
glVertex3f( 256.0f, 256.0f,-256.0f);

glVertex3f( 256.0f, 256.0f,-256.0f);
glVertex3f( 256.0f,-256.0f,-256.0f);
glVertex3f(-256.0f,-256.0f,-256.0f);
glVertex3f(-256.0f, 256.0f,-256.0f);

glVertex3f(-256.0f, 256.0f,-256.0f);
glVertex3f(-256.0f,-256.0f,-256.0f);
glVertex3f(-256.0f,-256.0f, 256.0f);
glVertex3f(-256.0f, 256.0f, 256.0f);

glVertex3f(-256.0f, 256.0f, 256.0f);
glVertex3f(-256.0f,-256.0f, 256.0f);
glVertex3f( 256.0f,-256.0f, 256.0f);
glVertex3f( 256.0f, 256.0f, 256.0f);

glVertex3f(-256.0f, 256.0f,-256.0f);
glVertex3f(-256.0f, 256.0f, 256.0f);
glVertex3f( 256.0f, 256.0f, 256.0f);
glVertex3f( 256.0f, 256.0f,-256.0f);

glVertex3f(-256.0f,-256.0f, 256.0f);
glVertex3f(-256.0f,-256.0f,-256.0f);
glVertex3f( 256.0f,-256.0f,-256.0f);
glVertex3f( 256.0f,-256.0f, 256.0f);
glEnd();
glPopMatrix();
The code to texture it is:



glBindTexture(GL_TEXTURE_2D, texture[4]);
I call that just before I call the function to draw the cube. And I know that code is working because I use it on all my other textured items. I just need to get it to texture the inside of the box :(

Swiftless
06-13-2005, 12:52 AM
Don't worry. I figured it out. I disabled the culling just before it drew the box, and it is working fine now.

Relic
06-13-2005, 03:42 AM
You could have kept the face culling enabled if you sent the quads' vertices reordered so that the faces' front points to the inside.