| Home | zeGraph lib | Lua lib | Custom lib | Tutorials | Notes | XML Script | C-Talk | Z-Script |
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19

Lesson 1 Concept

zeGraph uses a small number of objects to construct scenes and render them to a file or window, manipulate data array, and handle data input-output. These objects are built into the graph (zegraphL.dll), utility (zeutilityL.dll), and auxiliary (zeAuxiliaryL.dll) libraries. These three libraries are independent of each others. In principle, objects in a 3D scene can be created using solely the graph library, but the utility library would help to simplify complex operations. Figure 1.1 illustrates a scene structure. In summary, the minimal requirement for drawing any shape is to create a render, create a scene and add it to the render, create a node and assigned it to the scene as the root node; and then create shapes and add them to the node as leaves.

Figure 1.1 Tree structure of a zeGraph scene.

Note that there is no shape object in the first branch on the left. It does no harm to have the branch in the tree -- only a waste on memory and rendering time.

zeGraph uses the same Cartesian coordinate system as that of OpenGL (Figure 1.2). That is the positive x points to the right, the positive y to the top, and the positive z to the viewer. However, unlike most other OpenGL applications whose global x-, y-, and z-axis ranges from -1 to 1, the axes of zeGraph correspond to the view port size and depth in pixel unit. That is, assuming the view port width and height are w and h respectively, the x-axis ranges from -w/2 to w/2; the y-axis from -h/2 to h/2; and the z-axis from -max(w, h)/2 to max(w, h)/2 in an orthogonal projection and from 1 to 1+s*(w+h) in a perspective projection, where the s-factor is to be determined by the user.

Figure 1.2 Global coordinate system of zeGraph.

Understanding the coordinate system and 3D transformations are very important in creating 3D graphs, because changing the calling order of transformation functions with the same set of parameters may produce a completely different result.