This assignment is about OpenGL lighting. This assignment is due Friday, May 10.
Download this zip file. In the zip file you will find the program Exercise 11.14 on page 438 has you add "distance attenuation" (see pages 435-436) to the program's spotlight. Your program should let the user use the 'd/D' keys to decrease/increase the spotlight's quadratic distance attenuation parameter. Your program should also let the user use the 'u/U' keys to lower/raise the height of the spotlight, so that you can see the affect of the distance attenuation. Your program should also display the "Distance attenuation" parameter in the program window, just below the program's display of the "Spotlight attenuation" parameter. Also, let the user use the 'w/W' keys to turn off/on the program's wireframe display of the spotlight cone. Exercise 11.18 on page 441 has you allow the user to aim the spotlight at a point. Have the point that the spotlight is aimed at be in the plane that contains the centers of all the spheres. Allow the user to move this point by using two sliders added to the program, one along the top of the program window and one along the left edge. The top slider should move the x-coordinate of the point that the spotlight is aimed at. The left slider should move the z-coordinate of the point that the spotlight is aimed at. (You do not need to change the y-coordinate of the point that the spotlight is aimed at). This way, the user can "sweep" the spotlight over the tops of all the balls displayed in the window without moving the location of the spotlight. Notice that the arrow keys should still allow the user to move the spotlight horizontally, and the 'u/U' keys should move the spotlight up and down, while the sliders move the point that the spotlight is aimed at.
Turn in a zip file called |