Getting started on Project 2
Here's some advice about how I would start on the plant project.
- Start early
We can't help you much if you don't get started.
- Study up
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
to get some idea of how to draw.
- Get strater code
Get the code, make sure you can compile it in 67 Kemper
and that it draws a leaf.
Understand the drawing part of drawPlant.c; don't worry about the
functions to get and load the matrix, that's not your problem.
- Matrix multiply
Write a function that multiplies two 2D transformation
matrices together. Test it
by printing out the input and output or by looking at the running
code in the debugger or development environment, if you are using one.
- Move something
Translate, by multiplying the identity matrix by a translation
matrix, putting the result into Turtle, and call loadTurtle
to feed it down to the system, and then call drawLeaf
to draw the leaf.
Try it with a rotation matrix, then with a combined rotation-translation
matrix. Predict where the
leaf should appear each time, and if your prediction does not
come true figure out what went wrong before going to the next step.
- 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
Implement a matrix stack so that you can push and
pop the matrix state, and then implement branching in your plant by
pushing the matrix, drawing one branch, popping, and drawing another.
Or, you could avoid implementing a stack by using recursion, as we
discussed in class.
- NOW have fun!