Due: 9/19/00 at 3:00pm
You can find a shell of the program here and a simple Makefile here
The shell contains the calls to the GLUT routines which deal with opening an appropriate graphics window, accepting keyboard commands, and setting up the appropriate display loops. The program shell initially opens a 2D orthographic projection double-buffered window that is 500 pixels wide by 500 pixels tall that can be resized. The 'logical' graphics area stretches from -200 to 200 in both directions.
Within this area you will draw a rectangular paddle and a square ball. The user will move the paddle around the screen using the i/j/k/l keys moving up/left/down/right respectively. The edge of the paddle should stop at the edge of the screen - so the entire paddle should always remain visible on the screen. The ball will move about the window, bouncing off the sides of the window and bouncing off the sides of the paddle. The motion of the ball is fairly simple - the ball will keep a constant horizontal and vertical speed, but its direction will change appropriately when it hits an obstacle (i.e. if the ball hits a vertical surface then its horizontal velocity should change sign, if it hits a horizontal surface then its vertical velocity will change sign.)
The center of the ball will start out at logical coordinates 0,0. The center of the paddle will start out at logical coordinates 0, -150.
The program should accept a set of command line parameters. If these values are not changed via the command line then the program should use the built in defaults:
Your program should be well commented and be a good example of literate programming.
Your program will be submitted electronically. This will be discussed further in the discussion section. You can compile your program using the OpenGL libraries or any of the implementations of the Mesa libraries, but be sure that it compiles and runs on the SGI O2s in the EECS lab because that is where we will be compiling and running your program.
The biggest problem you will encounter is the dreaded 'black screen' - its hard to debug graphics code when you can't see any graphics on the screen. I would first get the code to draw the paddle and ball on the screen, then add the ability to move the paddle, then the movement of the ball, then the bouncing of the ball.
I would also highly recommend that you understand the code you are writing - you never know when you might need to reproduce it (hint hint).