I have a program which, simply put, is just a large collection of cuboid however, despite not being in the code, in release mode a random line comes out of every cuboid stretching on for infinity and in debug mode another cube appears this also stretches on for infinity. So I’m fairly sure its a compiler error but what causes these sort of wierd things?
These pictures might help.
release mode:
debug mode:
and the cube drawing code if it helps.
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTranslatef(x, y, z);
glBegin(GL_QUADS);
glColor4f(1.0, 1.0, 1.0, 1.0);
//Top Face
glTexCoord2d(0.0, 0.0); glVertex3f(0, height, 0);
glTexCoord2d(0.0, depth/8); glVertex3f(0, height, depth);
glTexCoord2d(width/8, depth/8); glVertex3f(width, height, depth);
glTexCoord2d(width/8, 0.0); glVertex3f(width, height, 0);
//Bottom Face
glTexCoord2d(0.0, 0.0); glVertex3f(0, 0, 0);
glTexCoord2d(0.0, depth/8); glVertex3f(0, 0, depth);
glTexCoord2d(width/8, depth/8); glVertex3f(width, 0, depth);
glTexCoord2d(width/8, 0.0); glVertex3f(width, 0, 0);
//Right Face
glTexCoord2d(0.0,0.0); glVertex3f(0, 0, 0);
glTexCoord2d(depth/8, 0.0); glVertex3f(0, 0, depth);
glTexCoord2d(depth/8, height/8); glVertex3f(0, height, depth);
glTexCoord2d(0.0, height/8); glVertex3f(0, height, 0);
//Left Face
glTexCoord2d(0.0,0.0); glVertex3f(width, 0, depth);
glTexCoord2d(depth/8, 0.0); glVertex3f(width, 0, 0);
glTexCoord2d(depth/8, height/8); glVertex3f(width, height, 0);
glTexCoord2d(0.0, height/8); glVertex3f(width, height, depth);
//Front Face
glTexCoord2d(0.0,0.0); glVertex3f(width, 0, 0);
glTexCoord2d(width/8, 0.0); glVertex3f(0, 0, 0);
glTexCoord2d(width/8, height/8); glVertex3f(0, height, 0);
glTexCoord2d(0.0, height/8); glVertex3f(width, height, 0);
//Back Face
glTexCoord2d(0.0,0.0); glVertex3f(width, 0, depth);
glTexCoord2d(width/8, 0.0); glVertex3f(0, 0, depth);
glTexCoord2d(width/8, height/8); glVertex3f(0, height, depth);
glTexCoord2d(0.0, height/8); glVertex3f(width, height, depth);
glEnd();
glBegin(GL_LINES);
glColor4f(0.0, 0.0, 0.0, 1.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(width, 0.0, 0.0);
glVertex3f(width, 0.0, 0.0);
glVertex3f(width, 0.0, depth);
glVertex3f(width, 0.0, depth);
glVertex3f(0.0, 0.0, depth);
glVertex3f(0.0, 0.0, depth);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, height, 0.0);
glVertex3f(width, height, 0.0);
glVertex3f(width, height, 0.0);
glVertex3f(width, height, depth);
glVertex3f(width, height, depth);
glVertex3f(0.0, height, depth);
glVertex3f(0.0, height, depth);
glVertex3f(0.0, height, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, height, 0.0);
glVertex3f(width, 0.0, 0.0);
glVertex3f(width, height, 0.0);
glVertex3f(width, 0.0, depth);
glVertex3f(width, height, depth);
glVertex3f(0.0, 0.0, depth);
glVertex3f(0.0, height,depth);
glEnd();
glPopMatrix();
}