3-D Wire Frame and Solid Models: Design and animation With OpenGL A.N.K Zaman (ankz@onebox.com), Md. Khademul Islam Mollah (khadem_ru@yahoo.com) and M. Ganjer Ali (ganjer_ru@yahoo.com) Dept of Computer Science & Technology, University of Rajshahi, Rajshahi-6205, Bangladesh. Abstract This paper presents an overview of design and development of animated 3-D graphics with OpenGL. To develop this animation, the 3-D wire frame models of objects and environments are drawn using the primitives supported by the OpenGL graphics system and a set of objects built from these primitives. To produce smooth animation of the models, double-buffering technique is used with the animation tool. The animated 3-D wire frame models are illuminated properly to produce the solid form. Material property is also applied during the illumination phase. Keywords: OpenGL, animation, wire frame models, solid models, double-buffering. Introduction In this millenium, the computer and communication technologies are becoming dominant forces in human lives. The combination of computers, networks, and the complex human visual system, through computer graphics, has new ways of displaying information, seeing virtual world, and communicating with both other people and machines. OpenGL is a particular graphics software system, becoming a widely accepted standard for developing graphics applications. Our approach is programming oriented to animated 3-D computer graphics. Design And Implementation Of 3-D Animation Models are abstractions of the world-both of the real world in which we live, and of virtual worlds that are created through the programs. Mathematical models are familiar to us, used in all areas of science and engineering. These models use equations to model the physical phenomena that one wishes to study. In computer science, abstract data types are used to model organizations of objects; in computer graphics, geometric objects are used to model our worlds. Computer graphics choosing which primitives to use in object models and deals how to show relationships among them. To develop a 3-D animation program with OpenGL, three phases are considered. PHASE 1: Three-dimensional wire frame models of robot and environment(s) are drawn using the primitives supported by the graphics system and/or a set of user defined objects built from these primitives. Building The Object (Robot) Body Figure 1.1 shows a boxlike representation of a human figure, or, possibly, of a robot. Figure 1.1 Figure Representation If torso is taken as robot element, one can represent figure with a tree, as shown in figure 1.2. Once the torso is positioned, the position and orientation of the other parts of the model are determined by the set of joint angles. Defining the motion of its joints animates the figure. In a basic model, the knee and elbow joints might each have only a single degree of freedom, like the robot arm, whereas the joint at the neck might have 2 degrees of freedom. The functions such as figure() and left_upper_arm(), that drawn the individual parts in their own frames. Now a set of nodes are built from tree (Figure 1.2) by defining a matrices that position each part relative to its parents, exactly as done for the robot arm. Each body part has been defined at the desired size and each of these matrices will be the concatenation of a translation matrix with a rotation matrix. These matrices are shown in Figure 1.2 by using the matrices to label the edges of the tree. It is important that matrix represents the incremental change from the parent to the child. To draw the robot body the tree is traversed from left to right, depth first i.e. starting from the left branch, follow it to the left as deep as one can go, then go back up to the first right branch, and proceed recursively. To draw the figure a function figure() is considered. The model-view matrix, M, in effect when this function is invoked determines the position of the figure relative to the rest of the scene (and to camera). The first node encounters and results in the torso being drawn with M applied to all the torso’s primitives. Then the leftmost branch of the tree is traced to the node for the head. Then the function head is with the model-view matrix updated to MM h. Next, returning to the torso node, then going down the subtree defining the left leg. This part looks just like the code for the robot arm; upper-left leg is drawn with the matrix MM lul , and the lower-left leg with matrix MM lul M lll . Then one can move on to the right leg, left-arm, and left-leg. Each time limbs are switched and returning to the root and recover M. It is probably easiest to think in terms of the current transformation matrix (C) i.e. the model-view matrix of C is applied to the primitives defined at a node. A current transformation matrix (C) starts out as M, is updated to MM h for the head, and later to MM lul M lll, and so on. The user program must manipulate C before "Int. Conf on Computer and Information Technology (ICCIT 2001) Dhaka University, 28-29 December 2001" 119 ISBN 984-32-015-2