Home arrow Multimedia arrow Page 2 - Animation in OpenGL for Game Programming using SDL

The Basics Continued: Coordinate Spaces - Multimedia

Animation is the backbone of immersive experience in any game. This applies to both 2-D and 3-D games without exception. Hence, in order to create a seamless and immersive game environment, one must first understand the whys and wherefores of animation. One of the advantages that OpenGL has over other graphics and gaming toolkits is that in OpenGL, animation APIs are not low-level.

TABLE OF CONTENTS:
  1. Animation in OpenGL for Game Programming using SDL
  2. The Basics Continued: Coordinate Spaces
  3. Animation APIs in OpenGL
  4. Animation: a Basic Example
By: A.P.Rajshekhar
Rating: starstarstarstarstar / 14
August 28, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As already mentioned in the previous section, each axis extends to the opposite direction infinitely. The part of the x-axis starting from the origin and extending toward the right is the positive x-axis, and the portion that extends toward the left is the negative x-axis. Similarly in the case of the y-axis, the part extending toward the top is designated positive whereas the other part is designated negative. This is true for all the possible spatial directions in 2-D. But in the case of 3-D, matters are different. In 3-D the vertical and the horizontal can be interchanged. Hence the two types of coordinate space rules have come into play. One concerns the left-hand coordinate space, while the other covers the right-hand coordinate space.

To find the left-hand coordinate space, with your left hand, make an L with your thumb and index finger such that the thumb is pointing toward the right and your index finger is pointing straight up, and your third finger is pointing inwards. What we get is a Left-Hand Coordinate Space. The thumb, the index finger and the third finger point to the +x, +y and +z directions, respectively.

If you repeat this procedure with your right hand, with your index finger pointing straight up, your thumb pointing toward the left and your third finger pointing inwards, then we get a Right-Hand Coordinate Space. Again the thumb, the index and the third finger point to +x, +y and +z directions.

Now for the fourth important concept: transformations. A transformation is a process that changes graphics objects from one state to another. The state can be any property of the object from coordinates to the color and texture. There are three basic transformations: rotation, translation and shearing. Of these rotation and translation are most commonly used. And these two form the basis of animation as well.

One important point to keep in mind about any kind of transformation is that all transformations are defined by a matrix. The best example is an Identity Matrix, which represents the Identity Transform. The Identity Transform, in essence, does nothing. I will cover more about transformation and matrix in the next part of the series.

Now that terminology and concepts have been discussed we can move on to the topics of immediate interest in animation -- rotation and translation.

Rotation, by definition, is "a transformation in which the coordinate axes are rotated by a fixed angle about the origin." In other words it is a transformation that shifts a graphic object around an axis. When the shifting is done continuously such that once the object reaches its initial position, the whole process is started all over again, the object is said to be animated. Since the shifting is done around the axis, the change of position is measured in Θ or degrees. Rotation can be clockwise or anti-clockwise. As the value of Θ decreases, the speed of rotation increases. Rotation around either the  x-,y- or z- axis is called principal rotation.

Translation, by definition, is the "Motion of a body in which every point of the body moves parallel to and the same distance as every other point of the body." In other words translation means linear movement along one or both axes. To compare, in rotation the object is shifted around one or more axes whereas in translation the object is shifted along one or more axes. Since the shift corresponds to the displacement along the axes, it is measured in Δ. In this case there is no requirement that the shift should, in the end, result in reaching the original position to have animation.

Pictorially rotation and translation can be viewed as:

That's all you need to know about concepts for this part. In the next section I will discuss how to use these concepts along with the OpenGL APIs to create basic animation.



 
 
>>> More Multimedia Articles          >>> More By A.P.Rajshekhar
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

MULTIMEDIA ARTICLES

- Basic Lighting in OpenGL and SDL Game Progra...
- Working with Colors in OpenGL for Game Progr...
- Animation in OpenGL for Game Programming usi...
- Game Programming with SDL: Getting Started w...
- Using OpenGL with SDL for Game Programming
- Learning Sound for Game Programming using SDL
- Game Programming using SDL: Raw Graphics and...
- Game Programming using SDL: Getting Started
- Network Radio With Icecast
- Learning To SMILe

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: