CMSC 435/634: Introduction to Computer Graphics

Assignment 2
Modeling
Due September 28, 2009

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 grammar. 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. Draw your plant to a window interactively using OpenGL.

Your program should be able to make a plant created from a grammar file provided on the command line. For example:

	Proj2 -g 3 -a 25.7 plant1.txt
should generate a plant 3 generations old using the grammar from plant1.txt and a rotation angle of 25.7 degrees.  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:

X
X=F-[[X]+X]+F[+FX]-X
F=FF

An example of a plant created by this system:


L-System Plant

More information about L-systems can be found here.

Using OpenGL

We will be using FreeGLUT, an implementation of the OpenGL Utility Toolkit (i.e. GLUT), which is installed on the UMBC GL system at:

    /afs/umbc.edu/users/o/l/olano/home/public/freeglut
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 will perform your rendering in the display() callback function, which is called whenever the window is being re-drawn.

The OpenGL libraries are installed on the university GL system. While it is possible to work remotely using ssh, you are encouraged to work locally on one of the OIT lab machines (just reboot into Linux). Some sample code for using GLUT in Linux is located at:

    /afs/umbc.edu/users/r/h/rheingan/pub/435/Proj2

For more information about OpenGL and GLUT, you have several resources available:

Extra Credit

What to turn in

Submit your assignment as 'Proj2'. 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).