-
8
pages
-
English
-
Documents
Description
Building up a SceneGraph in Xith3Dby Marvin FröhlichWhat is a SceneGraph?The actual rendering is done by OpenGL. So to answer this question we first need to understand, how OpenGL works.OpenGL renders primitives (like triangles), which are transformed by 4x4 transformation matrices. Transformations are translation, rotation and scale. Various effects like texturing or blending can be applied to these primitives. The whole scene is rendered frame by frame from a certain perspective. This perspective defines a view frustum, which is a mathematical body containing the visual part of the scene.Of course this is not very handy for a game programmer who wants to concentrate on game logic at first place. To make life easier for a game programmer using a SceneGraph is a good way to go. You can imagine a SceneGraph like a tree built of groups containing nodes, which can be groups again or leafs. The groups can be so called TransformGroups, which indirectly hold 4x4 transformation matrices to transform all children in this group (recursively). As a consequence TransformGroups can contain other TransformGroups and the resulting transformation for a contained leaf is the product of the multiplied 4x4 transformation matrices, which is passed to OpenGL. Use one transformation per TransformGroup. The transformation of the “higher” or “outer” TransformGroup effects the “lower” or “inner” one.The leafs are instances of Shape3D in most cases. Other leaf types exist ...
-
Publié par
-
Langue
English