PDA

View Full Version : Odd Texture Error



swamster
05-28-2003, 06:30 PM
The color from my 'door' texture spreads across the map about half the time. The color of the polygon the texture is on is white, so that can't be related to it. Screenshot here: http://dateryan.org/error.jpg

Leyder Dylan
05-29-2003, 04:50 AM
Have you correctly set your texture coord. ?

Please post the source code section who display you door and the texture.

swamster
05-29-2003, 12:37 PM
void addDoor(float z, float x, GLuint tex)
{
glBindTexture(GL_TEXTURE_2D, tex);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 1.0f); glVertex3f(x,1,0-z);
glTexCoord2f(0.0f, 1.0f); glVertex3f(x,1,0-(z+1));
glTexCoord2f(0.0f, 0.0f); glVertex3f(x,0,0-(z+1));
glTexCoord2f(1.0f, 0.0f); glVertex3f(x,0,0-z);
glTexCoord2f(1.0f, 1.0f); glVertex3f(x,1,0-(z+1));
glTexCoord2f(0.0f, 1.0f); glVertex3f(x+1,1,0-(z+1));
glTexCoord2f(0.0f, 0.0f); glVertex3f(x+1,0,0-(z+1));
glTexCoord2f(1.0f, 0.0f); glVertex3f(x,0,0-(z+1));
glTexCoord2f(1.0f, 1.0f); glVertex3f(x+1,1,0-(z+1));
glTexCoord2f(0.0f, 1.0f); glVertex3f(x+1,1,0-z);
glTexCoord2f(0.0f, 0.0f); glVertex3f(x+1,0,0-z);
glTexCoord2f(1.0f, 0.0f); glVertex3f(x+1,0,0-(z+1));
glTexCoord2f(1.0f, 1.0f); glVertex3f(x+1,1,0-z);
glTexCoord2f(0.0f, 1.0f); glVertex3f(x,1,0-z);
glTexCoord2f(0.0f, 0.0f); glVertex3f(x,0,0-z);
glTexCoord2f(1.0f, 0.0f); glVertex3f(x+1,0,0-z);
glEnd();
}

It makes a cube without a top/bottom, which may seem odd, but it makes sense for what I'm trying to develop. Its the exact same code as for the walls, just a different texture, so I'm not sure why the weird color strech thing is only happening on the doors.