Read chapters 3 and 4 in Angel's book and skim chapters 3 through 5 in the Red Book.
Do all of the following problems using your Subversion repository that comes
with your lab account. Consider placing them in your repository as follows:
/
homework
cmsi371
src
main
cpp
interactivespinner.cpp
retroshooter.cpp
spheresandcones.cpp
hatchedcircle.cpp
forestwalk.cpp
resources
(images go here)
doc
homework2.tex
Turn in a hardcopy of your solutions — generated as a PDF from your
LaTeX source with all source code attached. Make sure that you do not save
any tab characters in your source code, and that there is no line wrapping in
your printed submission.
- Tweak the spinning square program by adding keyboard input.
Pressing C should change the color of the square to some random
value (don't let it get too close to black), pressing - (the minus
key) should "slow down" the spinning and pressing + (the plus key)
should speed it up.
- Write a program that illustrates the operation of the rocket launcher in the old
Space Invaders game. That is, allow the user to move a launcher along the bottom of a
screen or window and fire rockets with left-button clicks. If the left button is held
down, put the launcher in "rapid-fire" mode. If you have time, add a single row of
invaders that move back and forth across the top of window but don't fire at you.
- Write an OpenGL application to animate little spheres
being shot out of a cone and falling through a torus.
- Write an OpenGL application that features a circle
moving slowly across the window. The circle should be
stippled with a cross hatched pattern. The purpose of this
problem is to show you how the stippling is relative to the
screen coordinates and not to the object; if done properly,
your animation should look funny — sort of like a
flashlight being slowly waved across a wallpapered
wall.
- Write an OpenGL application to simulate walking
through a grove of trees. The ground should be a very
large — okay huge — rectangle on the xz plane,
with a grassy texture mapped on it. Randomly place
a bunch of trees (maybe 100 or so) on the ground.
Each tree can be as
simple as a brown cylinder of height 4 and radius 0.5
with a green sphere of radius 3 sitting on top of it.
Simulate walking by moving the camera with the arrow
keys (or the mouse if you want). The camera should
simply hover 3 units above the ground. The up arrow key
should walk forward and the left and right arrow keys can make
10 degree turns. Make the scene fairly dark with a small
amount of ambient light, but make it look like the viewer
is holding a bright flashlight (you'll have GL_SPOT_CUTOFF
somewhere in your code).