
Homework 3 : Due Sept. 12, 2007
CS 470
September 5, 2007
1 Interface and interaction using glut
The purpose of this project is to familiarize you with glut menus and callback functions, and display
lists. Modify homework 2 to add the following features.
1.1 Specification
Based on homework 2, you will create an interactive 2D application with the following features:
•30% - Drag and drop using mouse motion: Allow the square to be selected when the pointer
is over the square and the left mouse button is pressed. While selected, the lines and points
making up the square should be colored yellow. Moving the mouse while the square is selected
should translate the square so that it is under the mouse. Releasing the left mouse button
should deselect the square. The square should now return to the original coloring scheme and
no longer move when the mouse moves.
•20% - Display lists : Render the grid background by using a display list. Do not recompile
the display list every frame. Create the display list once and render it in the display callback.
•20% - Pop-up menus : Create a pop up menu and attach it to the right mouse button. The
menu should have the following options: ”Quit” to exit the program, ”Reinit” to reinitialize
the square to its original position.
•20% - Reshape callback : Add a reshape callback that maintains the correct aspect ratio :
Your grid squares should remain squares after the window is resized. Update the projection
matrix using glOrtho.
•10% - Documentation.
Either full or zero credit will be given for each of these specifications.
2 What to turn in
Submit all source code, a README file, and a working project file or Makefile which builds an
executable named ’hw3’ or ’hw3.exe’. Turn in a single tarred and gzipped, or zipped file by the start of
class on the due date. Electronic submissions should be made through ecampus (ecampus.wvu.edu).
1