Scene Graphs

A scene graph is a hierarchical representation of a scene. In its simplest form, it means that objects can be grouped together, and attached to other objects. When one object is "attached" to another, it is said to be a child of the other object, and the other object is its parent. The child node is drawn in its parent's coordinate system - that is, any transformations that affect the parent also affect the child, and the child's own transformation is relative to the parent.

glPushMatrix()
 floorMesh.transform.apply()
 floorMesh.draw()
 
    glPushMatrix()
     ball.transform.apply()
     ball.draw()
    glPopMatrix()

    glPushMatrix()
     pedestal.transform.apply()
     pedestal.draw()

        glPushMatrix()
         teapot.transform.apply()
         teapot.draw()
        glPopMatrix()

    glPopMatrix()

glPopMatrix()