#include void myInit( void ) { //attributes glClearColor( 1.0 , 1.0 , 1.0 , 0.0 ); glColor3f( 0.0 , 0.0 , 0.0 ); glPointSize(4.0); //viewing glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D( 0.0 , 300 , 0.0 , 300 ); glMatrixMode(GL_MODELVIEW); } void display () { glClear(GL_COLOR_BUFFER_BIT); /* // // #1 // // put a red point 20 pixels to the right and 20 pixels up from the bottom left corner // put a blue point 20 pixels to the right and 20 pixels down from the top left corner glBegin(GL_POINTS); glEnd(); */ /* // // #2 // // put a line from the upper left corner to the lower right corner // if you don't change anything, what color is it? glBegin(GL_LINES); glEnd(); */ /* // // #3 // //create a "U" using a LINE_STRIP glBegin(GL_LINE_STRIP); glEnd(); */ /* // // #4 // // create a polygon using the same vertices you used in #3 glBegin(GL_POLYGON); glEnd(); */ /* // // #5 // // use the same vertices as in #4, but switch the order of your second and third vertices glBegin(GL_POLYGON); glEnd(); */ /* // // #6 // // use the same vertices, in the same order as #5, but try compiling with each of // the following polygon mode settings uncommented once //glPolygonMode( GL_FRONT_AND_BACK , GL_POINT ); //glPolygonMode( GL_FRONT_AND_BACK , GL_LINE ); //glPolygonMode( GL_FRONT_AND_BACK , GL_FILL ); glBegin(GL_POLYGON); glEnd(); */ /* // // #7 // // create a simple, but non-convex polygon, and try compiling with each of // the following polygon mode settings uncommented once //glPolygonMode( GL_FRONT_AND_BACK , GL_POINT ); //glPolygonMode( GL_FRONT_AND_BACK , GL_LINE ); //glPolygonMode( GL_FRONT_AND_BACK , GL_FILL ); glBegin(GL_POLYGON); glEnd(); */ glFlush(); } void main( int argc, char ** argv ) { glutInit(&argc,argv); glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); glutInitWindowSize( 300 , 300 ); glutInitWindowPosition( 100 , 100 ); glutCreateWindow(" Lab "); glutDisplayFunc(display); myInit(); glutMainLoop(); }