CMSC 435/634: Introduction to Computer Graphics

Assignment 3
Due April 3, 2012

The Assignment

Create a program that produces growing 2D plant models based on L-system growth techniques. L-sytems model plants using a grammar to simulate plant growth. Successive application of the production rules create a string which can be translated into geometry for display.


In order to render your string, interpret the characters of the string as following:

The angle A is given as part of the command line. The twig length d should be initialized to a suitable value and decrease to 70% of what it is currently in each successive generation. Your program should be able to handle at least 6 generations of a plant type.


Your program should output a plant model as an NFF file. Select an appropriate viewpoint and background color so that the plant is visible. Do not include any lights; for now, an ambient light is implied. Your model can include only spheres and cylinders as primitives, unless you add polygons to the provided viewer.


Your program should be able to make a plant created from a grammar file provided on the command line, outputting the generated NFF model on standard output. For example:

	Proj3 -g 3 -a 25.7 plant1.txt > plant1.nff
should generate a plant 3 generations old using the grammar from plant1.txt and a rotation angle of 25.7 degrees, with the generated NFF redirected to plant1.nff.  The arguments may come in any order, except the grammar file which will always be last. Plant, generation, and angle arguments are optional; choose appropriate defaults if none are given.

The L-system rules will be contained in a text file.  The first line will be the start symbol, with each subsequent line containing a rule for a particular symbol.  For example:


Consider the start symbol to be generation 0. An example of a plant created by this system:

L-System Plant

More information about L-systems can be found here.

Viewing the Model

We are providing a viewer that takes an NFF file as input and displays the scene using OpenGL, allowing the user to interact by rotating the model using the mouse, or the w, a, s, and d keys to rotate up, left, down, and right, respectively. Source code for the viewer is provided at:


The viewer makes use of the OpenGL Utility Toolkit (GLUT), which is available on any Mac OS X machine as well as the UMBC Linux machines, using the provided Makefile. GLUT is a utility toolkit that is designed to make it easier to use OpenGL with a window manager. It provides functions for handling windowing events (such as mouse clicks, key presses, etc).

You are encouraged to work locally on one of the OIT lab machines (just reboot one of the Windows machines into Linux, or use one of the Macs). If you want to develop locally on Windows, you will need to install freeglut yourself.

Extra Credit

What to turn in

Submit your assignment as 'Proj3' using cvs. Include your source code and makefile. Also include a readme file with a description what hardware/software environment you used to develop your project, and a description of any help you received (or a statement that no help beyond the text and course staff was received).