Quiz on Tuesday

Your quiz problem is specified in the comments on the Hunt the Wumpus programs below.

I will be late on Tuesday, No. 7, 2006. However, the lab will be open at 9:30am.

Example Programs

Hunt the Wumpus:

In the directory /u1/junk/cs440/Nov02, I left several examples.

The first texture example is in the file texture.c which uses the texture grass.ppm. Read the comments in the program.

The programs wump1.c through wump7.c deal with a simple maze that the user of the program can traverse. In wump6.c a texture file (bricks.ppm) is used to make the walls look like brick. To run that program you need to copy the file bricks.ppm to the directory where you run the program. In wump7.c, both the brick and grass texture files are used. Note that in wump6.c and wump7.c, the walls are made of polygons (actually quads) instead of cubes. As a result, the walls have no thickness.

Try using the file metal.ppm for the walls. You'll need to make the corresponding change in the program.

Your assignment is to add the following features:

  1. Give the walls a little thickness.
  2. Make the maze larger (at least 5x5).
  3. Place an object somewhere in the maze.
  4. Add a command ('p') that allows the user to pick up the object when the user is in the same room as the object.
  5. Add a command ('d') to allow the user to drop the object, after it has been picked up.
  6. Add the ability to change your viewing angle (so you can look at the ground, for example).

You are free to change any aspect of my example programs, so long as you use textures. Incidently, to convert graphics images to PPM format, you can use the convert(1) program: convert x.jpg x.ppm.

To read PPM files, you should use my readppm function from wump7.c, NOT the one from any other example. In that version, I added the ability to skip over comments in PPM files, which will probably be needed if you find your own texture files on the web.

Your program is due Friday, Nov 8, 2006 before class. Create an opengl directory, and place your final program in that subdirectory.


The car.c example done in class has been updated. The current version can be found at


When you run the program, you can use the up and down arrow keys to change the viewing angle.


Two more example programs can be found in the files


In the first one, two interlocking donuts are drawn. However, since the second donut is drawn after the first donut, it always appears in front, regardless of how the scene is rotated. In the second program, depth computations have been enabled ( the changes are on lines 34, 58 and 116 in donut2.c). When this program is run, the donuts do appear to be interlocked.