#include #include /* In this lab, we will create OpenGL program(s) to gain experience with interaction, callbacks, and window location. #1 Fill in the code below so that it puts a 4 pixel sized dot where the LEFT mouse button is clicked. You may choose color(s) and windowsize. The window should be refreshed (cleared) after each mouse click, so you should just see one dot at a time. Your program should stop when the RIGHT mouse button or the lowercase "q" are pressed. After this portion of the program is working, show it to the professor. #2 Change the code below so that is puts a polygon (each side is at least 10 pixels) centered where the LEFT mouse is clicked. What happens if you click near the edge of the window? #3 Finally, change the code below so that the window is NOT refreshed after each mouse click, so you see all the polygons. #4 When you are in "non-clear" mode, click outside the GLUT window. Then return to the window and continue clicking. Why doesn't it repaint the window? Now, toggle back to "clear" mode. */ // make your intial window size a pre-processor definition #define WINDOW 500 // define the window location with global variables GLint windowX, windowY; // set up color(s) and clipping window here void myInit() { glClearColor( ); glColor3f( ); glPointSize(4); // clipping window here glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D( ); glMatrixMode(GL_MODELVIEW); } // display callback void display() { glClear(GL_COLOR_BUFFER_BIT); glFlush(); } // mouse callback void mouse(GLint btn, GLint state, GLint x, GLint y) { } // keyboard callback void keyboard (unsigned char key , int x, int y) { } void main(int argc , char ** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize( WINDOW , WINDOW ); glutInitWindowPosition(50,50); glutCreateWindow("Mouse Clickin"); glutMouseFunc(mouse); glutKeyboardFunc(keyboard); glutDisplayFunc(display); myInit(); glutMainLoop(); }