Answers to Questions

1. The function glutDisplayFunc() is called with a function pointer as parameter at initialization. Whenever the window is redrawn, the function passed into glutDisplayFunc is called, which in turn can call whatever methods are needed to draw the image.

2. The parameter specifies the display mode and whether a single or double buffered window is used. The specific value in the assignment, GLUT_RGBA | GLUT_DOUBLE, means to use RGB mode instead of color indexing and to use double-buffered window.

3. The call to glViewport sets the part of the window that openGL can actually draw on. If we were resizing the window, we might want to change this so the graphics stay the same, like if we wanted an inset window of the same size surrounded by an empty border if the window was enlarged. The call to glOrtho defines a perspective for orthographic projection. In my program it is set up to be a flat 2D perspective.

Progam Description

My Assignment1 program is a simple cannonball shooter. Use W and D to adjust the aim of the cannon, and Q and A to adjust the power. The power bar is below the cannon; when it's all orangish you're at full power. Press F to fire and watch your shot. You can fire multiple times, but only one cannonball can be active at a time so you have to wait for your last shot to leave the screen. Unfortunately, the cheap-looking house is just a background; your shots will right through it.