I have show a progream hoe to  Draw a House  using C and OpenGL library

/*
 * GLUT Shapes Demo
 *
 * Written by Nigel Stewart November 2003
 *
 * This program is test harness for the sphere, cone
 * and torus shapes in GLUT.
 *
 * Spinning wireframe and smooth shaded shapes are
 * displayed until the ESC or q key is pressed.  The
 * number of geometry stacks and slices can be adjusted
 * using the + and - keys.
 */
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>

#include <GL/gl.h>
#include <GL/glut.h>
void display(void)
{

/*-- basement border -----*/
glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_LINES);

glVertex3f(0.20, 0.20, 0.0);
glVertex3f(0.80, 0.20, 0);

glVertex3f(0.25, 0.30, 0.0);
glVertex3f(0.75, 0.30, 0);

glVertex3f(0.25, 0.30, 0.0); /*  / line */
glVertex3f(0.20, 0.20, 0.0);

glVertex3f(0.80, 0.20, 0); /*  \ line */
glVertex3f(0.75, 0.30, 0);
/*-- End basement border -----*/
glEnd();

glLineWidth(2.50);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex3f(0.10, 0.10, 0.0);
glVertex3f(0.90, 0.10, 0); /* X access*/
glVertex3f(0.10, 0.10, 0.0);
glVertex3f(0.10, 0.90, 0); /*  y access*/
glEnd();

/*--- left rigt top bottom ----*/
glLineWidth(2.50);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(0.30, 0.30, 0);
glVertex3f(0.30, 0.60, 0);

glVertex3f(0.30, 0.60, 0);
glVertex3f(0.70, 0.60, 0);

glVertex3f(0.70, 0.30, 0);
glVertex3f(0.70, 0.60, 0);

glVertex3f(0.30, 0.30, 0);
glVertex3f(0.70, 0.30, 0);
glEnd();

glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_LINES);
glVertex3f(0.30, 0.30, 0);
glVertex3f(0.30, 0.60, 0);

glVertex3f(0.30, 0.50, 0);
glVertex3f(0.50, 0.50, 0);

glVertex3f(0.30, 0.32, 0);
glVertex3f(0.70, 0.32, 0);
glEnd();

glLineWidth(1.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_LINES);
glVertex3f(0.30, 0.30, 0);
glVertex3f(0.30, 0.60, 0);

glVertex3f(0.30, 0.50, 0);
glVertex3f(0.50, 0.50, 0);

glVertex3f(0.30, 0.40, 0);
glVertex3f(0.50, 0.40, 0);

glVertex3f(0.30, 0.60, 0);
glVertex3f(0.70, 0.60, 0);

glVertex3f(0.40, 0.40, 0);
glVertex3f(0.70, 0.40, 0);

glVertex3f(0.50, 0.50, 0);
glVertex3f(0.70, 0.50, 0);

glVertex3f(0.30, 0.55, 0);
glVertex3f(0.70, 0.55, 0);

glVertex3f(0.70, 0.30, 0);
glVertex3f(0.70, 0.60, 0);

glVertex3f(0.30, 0.30, 0);
glVertex3f(0.70, 0.30, 0);

glVertex3f(0.30, 0.32, 0);
glVertex3f(0.70, 0.32, 0);
glEnd();
/*--- End left rigt top ----*/

/*-- start window-----*/
glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_POLYGON);
    glVertex3f(0.58, 0.50, 0);
    glVertex3f(0.58, 0.40, 0);

    glVertex3f(0.67, 0.50, 0);
    glVertex3f(0.67, 0.40, 0);

    glVertex3f(0.58, 0.40, 0);
    glVertex3f(0.67, 0.40, 0);

    glVertex3f(0.58, 0.50, 0);
    glVertex3f(0.67, 0.50, 0);
 glEnd();

 glLineWidth(2.50);
glColor3f(0.556863, 0.556863, 0.556863);
glBegin(GL_LINES);
    glVertex3f(0.58, 0.50, 0);
    glVertex3f(0.58, 0.40, 0);

    glVertex3f(0.67, 0.50, 0);
    glVertex3f(0.67, 0.40, 0);

    glVertex3f(0.58, 0.40, 0);
    glVertex3f(0.67, 0.40, 0);

    glVertex3f(0.58, 0.50, 0);
    glVertex3f(0.67, 0.50, 0);
 glEnd();

glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_POLYGON);
    glVertex3f(0.33, 0.50, 0);
    glVertex3f(0.33, 0.40, 0);

    glVertex3f(0.42, 0.50, 0);
    glVertex3f(0.42, 0.40, 0);

    glVertex3f(0.33, 0.40, 0);
    glVertex3f(0.42, 0.40, 0);

    glVertex3f(0.33, 0.50, 0);
    glVertex3f(0.42, 0.50, 0);
    glEnd();
glLineWidth(2.50);
glColor3f(0.556863, 0.556863, 0.556863);
glBegin(GL_LINES);
    glVertex3f(0.33, 0.50, 0);
    glVertex3f(0.33, 0.40, 0);

    glVertex3f(0.42, 0.50, 0);
    glVertex3f(0.42, 0.40, 0);

    glVertex3f(0.33, 0.40, 0);
    glVertex3f(0.42, 0.40, 0);

    glVertex3f(0.33, 0.50, 0);
    glVertex3f(0.42, 0.50, 0);
    glEnd();
/*--End window--*/

/*--  roof --*/
/*left roof  */
glLineWidth(2.50);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.20, 0.50, 0);
glVertex3f(0.50, 0.84, 0);
glVertex3f(0.21, 0.55, 0);

glVertex3f(0.20, 0.50, 0);
glVertex3f(0.21, 0.55, 0);

glVertex3f(0.50, 0.84, 0);
glVertex3f(0.50, 0.80, 0);
glEnd();

/*right roof*/
glLineWidth(2.50);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.80, 0.50, 0);
glVertex3f(0.50, 0.84, 0);
glVertex3f(0.79, 0.55, 0);
glVertex3f(0.50, 0.84, 0);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.80, 0.50, 0);
glVertex3f(0.79, 0.55, 0);
glEnd();
/* rof broder */
glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_LINES);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.20, 0.50, 0);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.80, 0.50, 0);

glVertex3f(0.50, 0.84, 0);
glVertex3f(0.21, 0.55, 0);
glVertex3f(0.50, 0.80, 0);
glVertex3f(0.80, 0.50, 0);

glVertex3f(0.21, 0.55, 0);
glVertex3f(0.20, 0.50, 0);
glVertex3f(0.50, 0.84, 0);
glVertex3f(0.79, 0.55, 0);

glVertex3f(0.79, 0.55, 0);
glVertex3f(0.80, 0.50, 0);

glVertex3f(0.50, 0.84, 0);
glVertex3f(0.50, 0.80, 0);
glEnd();
/*  End roof */

/*inner roof*/
glLineWidth(2.50);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(0.50, 0.76, 0);
glVertex3f(0.36, 0.62, 0);
glVertex3f(0.50, 0.76, 0);
glVertex3f(0.64, 0.62, 0);
glVertex3f(0.36, 0.62, 0);
glVertex3f(0.64, 0.62, 0);
glEnd();
glLineWidth(2.50);
glColor3f(0.556863 , 0.419608 , 0.137255);
glBegin(GL_LINES);
glVertex3f(0.50, 0.76, 0);
glVertex3f(0.36, 0.62, 0);
glVertex3f(0.50, 0.76, 0);
glVertex3f(0.64, 0.62, 0);
glVertex3f(0.36, 0.62, 0);
glVertex3f(0.64, 0.62, 0);
glEnd();
/* End inner roof*/

/*-- End roofe --*/

/* Door */
glLineWidth(2.50);

glBegin(GL_POLYGON);
glVertex3f(0.45, 0.30, 0);
glVertex3f(0.45, 0.55, 0);

glVertex3f(0.55, 0.30, 0);
glVertex3f(0.55, 0.55, 0);

glVertex3f(0.45, 0.55, 0);
glVertex3f(0.55, 0.55, 0);
glEnd();

/* --end door---*/

glLineWidth(1.50);
glColor3f(0.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex3f(0.50, 0.35, 0);
glVertex3f(0.50, 0.50, 0);
glEnd();

/* don't wait!
* start processing buffered OpenGL routines
*/
glFlush ();
}
void init (void)
{
/* select clearing (background) color */
glClearColor (0.80, 0.80, 0.80, 0.80);
/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/*
* Declare initial window size, position, and display mode
* (single buffer and RGBA). Open window with "hello"
* in its title bar. Call initialization routines.
* Register callback function to display graphics.
* Enter main loop and process events.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (600, 600);
glutInitWindowPosition (600, 600);
glutCreateWindow ("hello");
init ();
glutDisplayFunc(display);
glutMainLoop();
return 0; /* ISO C requires main to return int. */
}
Leave a reply