MedicalVisualization
Scene Graph to Open GL
← Scene Graph Flattening | ● | Scene Graph APIs →
Previously the scene graph was implicitly defined. Given an explicit data structure, containing a scene graph, it can be translated into direct rendering commands by the following simple method:
- Apply the camera transformation first
- Walk the graph depth-first (by always keeping one hand on the “railing”).
- Whenever a transformation node is traversed down-wards, remember the actual modeling transformation (by issuing a glPushMatrix command). Then apply the respective local transformation.
- Whenever a geometry node is traversed down-wards, render it with the actual modeling transformation.
- Whenever a transformation node is traversed up-wards, restore the previous modeling transformation (by issuing a glPopMatrix command).
For example the following scene graph
is translated into the following direct OpenGL command sequence
← Scene Graph Flattening | ● | Scene Graph APIs →