To become familiar with GL4Java and OpenGL programming
Write a Java program using GL4Java OpenGL calls to create a grid whose squares change color when clicked on. Specifically, you should divide the window into a grid of 10 squares horizontally by 10 squares vertically and draw lines on the screen to show the grid pattern. Each grid square should start out black, and change to a new color wheneven the user clicks a mouse button within it.
Your program should consist of a single java file which should be commented with your name (the name you are registered under!) and ID number. The java file should implement a class "a1" (so the TA can save it as "a1.java", compile it and execute it using the command "java a1".) The file should be emailed as an attachment to email@example.com.
The time the mail is received will be used to determine whether or not the program is late, so be sure to allow a couple of minutes for the mail system to transmit your file if you are working right up to the deadline.
IMPORTANT: If the TA has to edit your files you will lose points. Similarly, the TA should be able to execute the class "a1", so using any other class as your main class will result in lost points. We are VERY SERIOUS about this: because the class is large, the TAs cannot afford to spend a few minutes making small fixes to each assignment.
This program is due on or before Friday, August 30th. This means it must be received by 11:59pm EDT on Friday to not be considered late.
At a minimum, your program should create a window of at least 500x500 pixels, and use grid lines 1 pixel wide.
As a starting point, have a look at this simple example, triangle.java. You might also want to look at other GL4Java examples and the documentation for GL4Java.
HINT 1: You will need to keep track of the color of each square (possibly in a double dimension array) so the screen can be redrawn correctly by your class display method when the window is resized or otherwise needs to be redrawn.
HINT 2: You will use the standard Java event listener interface to receive mouse events on your window. See the GL4Java sample programs for how to do this. Similarly, you will probably need to cause the window to be redrawn after processing a mouse click.
HINT 3: You will need to keep track of the size of the window and use this window size to determine which square the mouse is in, based on the mouse position when a button is pressed.
There are no extra credit options on this assignment.