Dear All,
I am rendering a 3D house with differen faces, I am assiging different colors to different faces.What is happening at some faces, the two colors are displayed. I have drawn several houses in a scene. While moving around the scene, at some corners of houses,triangle type thing are generated .Triangle creates a transparency and able to see the other face of the house.
I am giving the code below. Kindly tell where lies the problem
glColor3f(0.0f,1.0f,0.0f);
glTranslatef(0.0,-1.75,0.0);
glBindTexture(GL_TEXTURE_2D,texName[2]);
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.95);
glVertex3f(0.0,0.0,0.0);
glVertex3f(2.0,0.0,0.0);
glVertex3f(2.0,1.0,0.0);
glVertex3f(1.0,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(0.0,0.0,1.0);
glVertex3f(2.0,0.0,1.0);
glVertex3f(2.0,1.0,1.0);
glVertex3f(1.0,1.5,1.0);
glVertex3f(0.0,1.0,1.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(2.0,1.0,1.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,0.0,1.0);
glVertex3f(0.0,1.0,0.0);
glVertex3f(0.0,1.0,1.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
glVertex3f(2.0,0.0,0.0);
glVertex3f(2.0,0.0,1.0);
glVertex3f(2.0,1.0,1.0);
glVertex3f(2.0,1.0,0.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.0);
glVertex3f(0.0,1.0,0.0);
glVertex3f(0.0,1.0,1.0);
glVertex3f(1.0,1.5,1.0);
glVertex3f(1.0,1.5,0.0);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0.0,0.0,0.0,0.0);
glVertex3f(2.0,1.0,0.0);
glVertex3f(2.0,1.0,1.0);
glVertex3f(1.0,1.5,0.0);
glVertex3f(1.0,1.5,1.0);
glEnd();
Thanks