/*
 *  simple.c
 *  This program draws a purple rectangle on a grey background.
 */

/* E. Angel, Interactive Computer Graphics          */
/* A Top-Down Approach with OpenGL, Third Edition   */
/* Addison-Wesley Longman, 2003                     */
/* Modified by Bary W Pollack; Jan. 27, 2005        */

#include <GL/glut.h>         /* glut.h includes gl.h and glu.h*/

void display (void)
{
    /* clear window */
    glClear (GL_COLOR_BUFFER_BIT); 

    /* draw a unit square polygon */
    glBegin (GL_POLYGON);
    glVertex2f (-0.5, -0.5);
    glVertex2f (-0.5,  0.5);
    glVertex2f ( 0.5,  0.5);
    glVertex2f ( 0.5, -0.5);
    glEnd();

    /* flush GL buffers */
    glFlush(); 
}


void init ()
{
    /* set clear color to grey */
    glClearColor (0.5, 0.5, 0.5, 0.0);

    /* set fill color to purple */
    glColor3f (1.0, 0.0, 1.0);

    /* set up standard orthogonal view with clipping */
    /* box as cube of side 2 centered at origin */
    /* This is default view and these statement could be removed */
    /* glMatrixMode (GL_PROJECTION);

    glLoadIdentity ();
    glOrtho (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);  */
}

int main (int argc, char** argv)
{
    /* Initialize mode and open a window in upper left corner of screen */
    /* Window title is name of program (argv[0]) */

    glutInit (&argc, argv);
    /* glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);  
    glutInitWindowSize (500, 500);
    glutInitWindowPosition (0, 0); */
    // glutCreateWindow ("simple");         replaced BWP
    glutCreateWindow (argv [0]);
    glutDisplayFunc (display);
    init ();
    glutMainLoop ();

    return 0;
}
