Getting started on Project 3
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, pages 29-49,
to get some idea of how to draw.
Look on the Web version of the book if you do not own it; there is a link from the TA's Web page.
- 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
transformation 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
Study up on the OpenGL matrix stack in the OpenGL Programming Guide, and
then use it to save and restore the matrix.
- NOW have fun!