02/05/2002
15-462 Graphics I
24
Hierarchical Tree Traversal
•
Order not necessarily fixed
•
Example:
void drawFigure()
{
glPushMatrix();
/* save */
drawTorso();
glTranslatef(...); /* move head */
glRotatef(...);
/* rotate head */
drawHead();
glPopMatrix();
/* restore */
glPushMatrix();
glTranslatef(...);
glRotatef(...);
drawUpperArm();
glTranslatef(...)
glRotatef(...)
drawLowerArm();
glPopMatrix();
... }