<html> <head> </head><body><pre><html> <head> </head><body><pre>&lt;html&gt; &lt;head&gt; &lt;/head&gt;&lt;body&gt;&lt;pre&gt; /* ** File: square2.c ** Description: A simple C program using OpenGL ** and GLUT to render a yellow square ** with a blue border on a white background. ** Rev: 1.0 ** Created: 26 August 2001 ** Last Update: 22 July 2002 ** Author: Fran Soddell ** Email: F.Soddell@bendigo.latrobe.edu.au */ #include &amp;lt;GL/glut.h&amp;gt; /* ** colour management */ #define NUM_COLOURS 8 #define ALPHA 0.0 enum {black, red,green,blue, yellow,magenta,cyan, white }; typedef GLfloat colourType[3]; colourType colour[NUM_COLOURS]={ {0.0,0.0,0.0}, {1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}, {1.0,1.0,0.0},{1.0,0.0,1.0},{0.0,1.0,1.0}, {1.0,1.0,1.0} }; /* ** model management */ enum {x,y}; typedef GLdouble vertexType [2]; int numVertices=4; vertexType square[]={ {-0.5,0.5},{0.5,0.5},{0.5,-0.5},{-0.5,-0.5} }; /* ** *********************************************************** */ void render(vertexType * image, int numVertices, GLenum mode){ int i; glBegin(mode); for(i=0;i&amp;lt;numVertices;i++) glVertex2d(image[i][x],image[i][y]); glEnd(); } void renderView(){ glColor3fv(colour[yellow]); render(square,numVertices,GL_POLYGON); glColor3fv(colour[blue]); render(square,numVertices,GL_LINE_LOOP); } void display(){ /* ** Clear the window with the background colour before ** (re)rendering. */ glClear(GL_COLOR_BUFFER_BIT); renderView(); glFlush(); } void setUpGLUT(int argc,char ** argv){ glutInit(&amp;amp;argc,argv); glutCreateWindow(&amp;quot;Square&amp;quot;); /* ** Register callbacks. */ glutDisplayFunc(display); } void initialiseGL(){ /* ** Set the background colour ** (clear colour) to white. */ glClearColor(1,1,1,ALPHA); } int main(int argc,char ** argv){ setUpGLUT(argc,argv); initialiseGL(); /* ** Display window and enter the GLUT event ** processing loop. */ glutMainLoop(); return 0; } &lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</pre></body></html></pre></body></html>