01/30/2003
15-462 Graphics I
10
Saving State
•Assume xl, yl, zl hold light coordinates
glMatrixMode(GL_MODELVIEW);
drawPolygon();    /* draw normally */
glPushMatrix();    /* save current matrix */
glTranslatef(xl, yl, zl);      /* translate back */
glMultMatrixf(m);              /* project */
glTranslatef(-xl, -yl, -zl);  /* move light to origin */
drawPolygon();    /* draw polygon again for shadow */
glPopMatrix();      /* restore original transformation */
...