I have drawn a house with a slanted roof in opengl. I am having problem in defining the normals for the slanted roofs.It wont be parallel to the axes so this is what I have used:
glBindTexture(GL_TEXTURE_2D,texture[3]);
glBegin(GL_QUADS);
glColor3f(1,1,0);
glNormal3f(0,cos(th),sin(th));
glTexCoord2f(0,0);
glVertex3f(2,1.25,1);
glTexCoord2f(1,0);
glVertex3f(2,2.2,0);
glTexCoord2f(1,1);
glVertex3f(-2,2.2,0);
glTexCoord2f(0,1);
glVertex3f(-2,1.25,1);
glEnd();
glBindTexture(GL_TEXTURE_2D,texture[3]);
glBegin(GL_QUADS);
glColor3f(1,1,0);
glNormal3f(0,cos(-th),sin(-th));
//glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex3f(-2,1.25,-1);
glTexCoord2f(1,0);
glVertex3f(-2,2.2,0);
glTexCoord2f(1,1);
glVertex3f(2,2.2,0);
glTexCoord2f(0,1);
glVertex3f(2,1.25,-1);
glEnd();
My program allows the user to choose the angle from which he wants see the object th is that angle..
It seems the lighting is not right.
Can anyone please help me?