
CMSI 371
COMPUTER GRAPHICS
Spring 2009
Assignment 0122
This initial assignment is meant to get you into a development groove with OpenGL.
Not for Submission
By January 20
1. If necessary, set up your primary work machine
for OpenGL and C development.
2. Enter the spinningsquare.c sample code as is to
make sure that you can build and execute
OpenGL C code, so that you can bring up any
questions or issues on the January 20 class.
3. Once you get the source code working without
modifications, try to do at least two of the re-
quested improvements by January 20 so that
you can ask questions in class.
4. Run the setup-class script for class cmsi371 and
user dondi so that you can start committing
your work. This sets up your private repository
for this course, similar to previous courses; you
will have a different, shared repository for the
graphics project. Setup instructions for that
are forthcoming.
If you encounter any problems with setup-class or
CVS, contact either Andrés Buriticá, our lab man-
ager, or me. The Keck lab machines should all be
ready, “out of the box,” for OpenGL and C devel-
opment. If you need help with setting up your
own personal machine for OpenGL and C, let me
know as soon as possible.
By January 22
5. Read Chapters 1 and 2 in the red book.
6. Type in, compile, and run the icosahedron.c sam-
ple code as well, just so you can log more time
with just writing and building OpenGL C code.
For Submission
Get your hands dirty with OpenGL — take the
spinningsquare.c program and make the following
changes to it:
1. Change the object(s) being drawn. Go on, be
creative, knock yourself out.
2. Change the way spinning is toggled: instead of
a mouse click, use the keyboard. You’ll need to
use glutKeyboardFunc instead of glutMouseFunc,
and the function you pass should have signa-
ture void func(unsigned char key, int x, int y). Re-
member that the authoritative definitions for all
of these functions reside in glut.h — don’t hesi-
tate to open and read that file when needed.
3. Change the title, initial size, and initial location
of the window.
4. Change the axis of the object’s rotation (the
sample version rotates around the z axis).
5. Implement the following keyboard controls
(and their corresponding functions):
a. + and – increase and decrease the rate of
rotation, respectively.
b. [ and ] decrease and increase the frame rate
of the animation.
c. The C key changes the object’s color (or
color scheme, in case you figured out how
to draw objects with multiple colors).
d. The S key changes the object being drawn
(i.e., rotate among 2 or more different ob-
jects as the user hits the S key).
Commit your work under /homework/cmsi371/
spinningshape. At this point, you should also be
aware that “committing” doesn’t just mean “sub-
mitting,” but progressively saving what you do so
that you can recover prior code as needed!