CSE 457: Intro to Computer Graphics

Spring Quarter 1995


Project 0: Sierpinski

Date Assigned: Wednesday, March 30, 1995
Date Due: Not to be turned in

Project objectives

The purpose of this assignment is primarily to give you some experience with using the Indys, the CaseVision development environment, OpenGL, and libui, the user interface library.

The graphics aspects of this assignment are trivial, so I'd like you to spend most of your time on this assignment becoming an expert at building and debugging simple graphical user interfaces. The more time you invest now understanding how to use the Indys, and to a lesser extent, OpenGL, the more time you'll have later to concentrate on the graphics.

To get started, make a copy of the directory /cse/courses/cse457/sierpinski. Note that you want to copy the files to your account on the Indys, not on wolf, lynx, or grizzly. After you've read over this assignment description, check out the Project 0 help session for intorductory tutorials on making a home page, OpenGL, libui, and CaseVision. Also, now may be a good time to check out the starting-point, example-solution, and example-solution2 programs.

Required extensions

  1. Add a button (like the "Quit" button) that executes the following process, called an iterated function system: Three points numbered 1, 2, and 3 are plotted at the vertices of an equilateral triangle. A fourth point, P, is randomly generated and its position is plotted. A random integer, R, in {1,2,3} is generated (using rand() or random()), and P is moved halfway from its current position to the Rth point. The new position of P is plotted, then another R is generated and the process is repeated, for say 500 iterations. Despite the randomness a very repeatable pattern emerges.

  2. Use the slider to control the number of iterations.

  3. Allow the user to position the original three points using the mouse. Draw these points as medium-sized yellow circles.

  4. When the program window is covered by another window and then exposed, the drawing window is cleared. Extend the program so that the dots are redrawn as if the window had never been covered.

Bells and Whistles

One bell is worth two whistles.

Allow the user to interactively move (drag) the original three points.


Add a "Stop" button that can be used to interrupt the program as it executes the iterated function system.

All sorts of shapes can be generated with iterated function systems by changing how P moves when various random numbers come up. For instance, try the following: when the number 2 is generated, rotate P by 45 degrees using point 2 as the center of rotation.

Now that you've got the basics down, go nuts. Add more buttons; add things to the pop up menu; build your own interactive video game; start a company to sell it.

And Finally...

When you are finished with this assignment, you will probably want to remove the executables and object files from your copies of the directories. To do this, a "make clean" option is available in the Makefiles.