Getting started on Project 2
Here's some advice about how I would start on Project 2.
- Start early
We can't help you much if you don't get started.
- Study up
Read the handout on L-systems, and
look at the readings on
transformation matrices. This is the material you are supposed
to demonstrate that you know.
Look in the OpenGL book at the Drawing survival kit, pages 29-49,
to get some idea of how to draw.
- Get strater code
Get the code, make sure you can compile it and that it draws a leaf.
Understand drawplant.c.
- Matrix multiply
Write a function that multiplies two matrices together. Test it
by printing out the input and output or by looking at the running
code in ddd, or, if you're using it, in Studio.
- Move something
Translate, by multiplying the identity matrix by a translation
matrix, feed the result to OpenGL, and then draw the leaf.
Try it with a rotation matrix, then with both. Predict where the
leaf should appear each time, and if your prediction does not
come true figure out what went wrong before moving on.
- Draw a vine
Try making a complicated picture without branching; draw a vine,
for instance. Keep a track of your current matrix, and translate and
rotate by multiplying it by translation and rotation matrices.
Draw, change the matrix, draw, change the matrix....
- Implement branching
One way to do this is to implement a matrix stack.
Another way is to
make a function that saves the value of the current matrix,
does some recursive drawing (which might change the matrix),
and then restores it.
Either way, make sure you can implement the simple tree
L-system in the handout.
- NOW have fun!