CS 476 Computer Graphics, Homework #5
Due: Mon Nov 3 at start class.
It is time to combine some of the graphics concepts to build
something a little bit larger.
- Create a program that lets the user graphically specify a set of
vertices for a smooth curve. You can do this in 2D or 3D; if in 2D,
map your (x,y) vertices onto OpenGL (x,0.0,z) 3D vertices when finished.
The user should be able to add new vertices by
left-clicking in the window. The user should be able to remove vertices by
right clicking on them. The vertices should be ordered. The user should be
able to add new vertices into the middle of the ordering, not just the end.
Left clicking a vertex specifies that the next vertex should follow the
clicked vertex.
- When the user presses "ENTER", they are done entering vertices.
Draw a filled (green) polygon (or smooth curve, if you prefer) between
the specified vertices. Close the
shape, meaning add its first point as an end point if the first point and
end point are not the same already. This blue shape is to represent the
"lawn" inside the racetrack.
- Draw a little 3D image of a car that "races" around
the outside edge of the track. Note: it is acceptable for
the "car" to be very crude, such as a brick with a cube on top of it.
To do this you will need to compute a set of
points around the edge (either a larger polygon, or better would be a
smooth curve), and at each step, erase the scene and redraw with the
car at its new position.
- Draw the car's orientation, i.e. rotate it so it "faces" the direction
in which it is moving. Rotation is built-in to OpenGL, your definition of
"faces" will depend on your depiction of the car.
- Turn in your solution by e-mail to jeffery@cs.uidaho.edu
- Numerous possibilities for extra credit: this is a very open-ended
assignment, feel free to extend it.