I am having some weird trouble with tutorial 6 from NeHe's site.
I was making the 3d cube, no big deal. I was in a rush to texture one face of it and see what it looked like so i only made the top, front, and bottom of the cube.
They were rotating perfectly, everything looked good! That is when i decided to throw a texture on the front face of the cube.
Well at first it was almost pitch black, i had to comment out the top and bottom faces of my cube and then the texture is tiled on the front face of the cube!!!
I will post the Redering function so you can tell me if i am doing anything wrong.
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(0.0f, 0.0f, -6.0f);
//glRotatef(rquad,0.0f,1.0f,0.0f);
glRotatef(xrot, 1.0f, 0.0f, 0.0f);
glRotatef(yrot, 0.0f, 1.0f, 0.0f);
glRotatef(zrot, 0.0f, 0.0f, 1.0f);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
//Top of cube
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(1.0f, 1.0f, 1.0f);
//Bottom of cube
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f(1.0f, -1.0f, 1.0f);
//Front of cube.
//glColor3f(0.0f, 0.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(-1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(-1.0f, -1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, -1.0f); glVertex3f(1.0f, -1.0f, 1.0f);
glEnd();
xrot+=0.3f;
yrot+=0.2f;
zrot+=0.4f;
//rquad-=0.15f;
return TRUE;
}
EDIT:: Sorry i figured out why it was tiling, DOH!
That still does not clear up the issue as to why it gets really dark when i try to draw in the top and bottom faces of the cube.
They were looking great before i textured it.
[edited by - Springer on October 6, 2002 1:14:09 AM]