CSCE 4230 Program #1 Due date: Tuesday, 02/03/2009 Using OpenGL and GLUT, write a program that implements Michael Barnsley's 'chaos game'. Select three vertices v1 = (x1,y1), v2 = (x2,y2), and v3 = (x3,y3) and an initial point p0 = (x0,y0). Store the coordinates as global variables. Write a reshape callback function that creates a square viewport (glViewport), and a view volume appropriate for the vertices (glOrtho or gluOrtho2D). Write a display callback function that implements the following loop: Initialize p = (x,y) to p0 = (x0,y0) n = 30000 For i = 0 to n-1 Select v from the set {v1,v2,v3} at random. Set p to the midpoint between v and the previous value of p. Draw a point at p (using glBegin(GL_POINTS), glVertex2d, and glEnd). Endfor Write a keyboard callback that terminates the program on the Escape keypress. Example program alpha.c (pp. 241-242) includes a call to glutKeyboardFunc, as well as glutReshapeFunc. Write a main function that initializes the Glut library, registers the callbacks, etc. Submit a source code listing (with your name on it) and a screen dump at the beginning of class on the due date.