(35 points)
Write an OpenGL program that allows interactive creation and manipulation of
filled squares, rectangles, polygons, and so on.
I will not give complete specifications for the program. It is up to you to design the details of the visual presentation and user interaction. However, the following functionality is required:
For polygons, you don't know ahead of time how many vertices there will be. A sequence of click and drag gestures can be used to define a polygon. Each "left mouse down" and subsequent "mouse up" event defines a new edge of the polygon, starting from the most recently created vertex. The first "mouse down", of course, will need to define the position of the first vertex.
In polygon creation mode, an additional requirement is that you must be able to "undo" the most recent vertex creation. For example, if you're in the middle of creating a polygon and have defined four points so far, you should be able (by a middle button click or other means) to remove the most recently created vertex, leaving you with three again (from which point you can add a new fourth vertex and so on).
For the "additional shape or feature of your own design" you may choose something such as circles (approximated as a regular polygon with a user controlled number of sides), regular n-gons (with user control of n), etc. Or, if not a new shape, add something like stippling or variable edge thickness.
The OpenGL Programming Guide is a bit skimpy on GLUT (the GL Utility Toolkit which allows you to do simple window management and mouse and keyboard interaction), especially on the GLUT menu-related functions. You will find the The OpenGL Utility Toolkit (GLUT) Programming Interface API Version 3 helpful; it is GLUT documentation written by Mark Kilgard, the author of GLUT (NOTE: it is not 100% up to date with the very newest versions of GLUT, but this shouldn't matter for the class).