#include void myinit(void) { /* attributes */ glClearColor(1.0, 1.0, 1.0, 1.0); /* white background */ glColor3f(1.0, 0.0, 0.0); /* draw in red */ /* set up viewing */ /* 512 x 512 window with origin lower left */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 512.0, 0.0, 512.0); glMatrixMode(GL_MODELVIEW); } void display( void ) { /* define a point data type */ typedef GLfloat point[2]; point p; /* A point in 2-D space */ int i, j, k; int red, green, blue; glClear(GL_COLOR_BUFFER_BIT); /*clear the window */ red = 1; green = 0; blue = 0; glColor3f((float) red, (float) green, (float) blue ); /* define point */ p[0] = 256; p[1] = 256; /* plot new point */ glBegin(GL_POINTS); glVertex2fv(p); glEnd(); glFlush(); /* clear buffers */ } void main(int argc, char** argv) { /* Standard GLUT initialization */ glutInit(&argc,argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); /* default, not needed */ glutInitWindowSize(512,512); /* 512 x 512 pixel window */ glutInitWindowPosition(0,0); /* place window top left on display */ glutCreateWindow("This Space For Rent"); /* window title */ glutDisplayFunc(display); /* display callback invoked when window opened */ myinit(); /* set attributes */ glutMainLoop(); /* enter event loop */ }