A 3d House

#include <GL/glut.h>
Dear All,

I want to render to a 3d House(barn) . I wrote the following code.But its creating only front side with a triangle and a rectangle.It is not creating a thacthed house.What modifications should I make

void render(void)
{
GLfloat x,y,z,angle;
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(xRot,1.0f,0.0f,0.0f);
glRotatef(yRot,0.0f,1.0f,0.0f);
glColor3f(0.0f,1.0f,1.0f);
glTranslatef(0.0,0.0,-5.0);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(1.0,0.0,0.0);
glVertex3f(1.0,1.0,0.0);
glVertex3f(0.5,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glVertex3f(0.0,0.0,1.0);
glVertex3f(1.0,0.0,1.0);
glVertex3f(1.0,1.0,1.0);
glVertex3f(0.5,1.5,1.0);
glVertex3f(0.0,1.0,1.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
/* glFlush(); */
}

Regards

You can´t create more than one polygon the way you tried it. Do this instead:

glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(1.0,0.0,0.0);
glVertex3f(1.0,1.0,0.0);
glVertex3f(0.5,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glEnd ();

glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,1.0);
glVertex3f(1.0,0.0,1.0);
glVertex3f(1.0,1.0,1.0);
glVertex3f(0.5,1.5,1.0);
glVertex3f(0.0,1.0,1.0);
glEnd();

There are rules to follow when creating polygons.
First, all points of a single polygon must lay on a single plain. Thats why triangles are so often used, because any 3 points will always lay on a single plain.
Second, all points must be plotted either clockwise or counterclockwise, depending on which left/right hand rule you are using.
Lastly, this is a little hard to explain, you can not create concave polygons. If there is a point in your polygon that may lay inside of subsequent point, it will be skipped. Odd results can occure from concave polygons.
Anywho, that’s my two cents.