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
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!
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 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:
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