Project 2: Fractal Plants
CS354 Computer Graphics
Due: October 15, 11:59pm


Goal
This project is on drawing two-dimensional fractal plants. Part of the project is implementing and using your own transformation matrices; this way you'll understand how they are used in OpenGL and other graphics systems. The basic project described below is worth 85%. To get 100% or more, you'll need to implement some additional features.

Project Specifications
Read carefully this handout on L-systems. Next understand the purpose and use of MODELVIEW matrix of OpenGL, you may refer the reference book mentioned below or some on-line OpenGL tutorial for it.

Your plant should be defined using recursive functions corresponding to a simple L-system. Consult the handout on L-systems for detailed instructions. Your L-system should include at least branching, turning and scaling. The plant should include at least leaves and branches (other primitives like flowers and fruits are optional). So your L-system should include at least two character symbols, such as `F' for branch and `L' for leaf, and use branching (brackets `[]') and turning (`+' and `-'). Give the definition of your L-system in your documentation.

You must specify the transformations used by your L-system by specifying your own matrices, and loading them into the OpenGL MODELVIEW matrix. The OpenGL commands you may NOT use this time are glRotate, glScale, glTranslate, glMultMatrix, glPushMatrix and glPopMatrix. Instead, you should keep track of your own 2D version of the MODELVIEW matrix, and modify it by post-multiplying it by translation matrices, rotation matrices, etc. You can use the function load2DMatrix in the starter code to put a 2D matrix into the OpenGL MODELVIEW matrix.

Your program should be able to take depth of the L-system as an input parameter. You mau include this in your user interface.

Check out these additional features  that you can add. Anything else that you think is interesting and/or neat looking then go for it!
Look at some of the cool images from previous semester to get further inspired!

Getting started
Here is the starter code which brings up a GLUI window and draws a leaf. It includes a function to load a 2D transformation matrix into the 3D OpenGL MODELVIEW
matrix properly. To compile it, type "make BOX=dell" on the Dell Linux machines in Taylor/Painter basement labs. This will produce an executable "plant". If you want to use some other machine, you may look at the information and links from project 1 to do so.  

Look here for some suggestions about getting started.

Questions Related to the Project (20% of the project score)
1. If you think carefully, you are drawing the plant from left to right (or may be from right to left); you may also see this by inserting sleep() or putting getchar() before drawing a branch. How can you draw the plant from bottom to top instead? This will show a more realistic growth of a plant.
2. What is the difference between L-systems and context-free grammars? How does this difference help in generating more realistic plants?
3. What will be the difficulties in drawing such plants without using fractals? What did you learn about the usefulness of fractals by doing this project?

What and how to submit
Your program should compile and run on the Taylor or Painter basement machines. Then submit the following files:

The README file should be a plain text file, it should clearly mention: your name, what the submitted files contain (e.g. which is the executable, which contain the source code etc.), how and on which machine(s) your program compiles and runs, and a short description of the user interface.

The report should also be a plain text file which should contain the description of the L-system you implemented (in the form of rules) and the answer to the above "Questions Related to the Project".  In the report please mention all the extra features that you have implemented else we may fail to notice and hence credit them. In addition, if appropriate, you may also write about what  new ideas you came up with, what design decisions you took etc; please keep such a  discussion short and to the point.

You should grab the image of the best plant you generated by using  xv command on Taylor/Painter basement machines.  Save it as gif or jpeg file. Here is a note on how to grab a window using xv.

Use the turnin program to submit your files. You have to turnin to: rjkate cs354-project2
Here is a short note on how to use turnin program.

OpenGl Reference book
Neider, Davis and Woo, "OpenGL Programming Guide" Second Edition, Addison-Wesley