Multimedia
  Home arrow Multimedia arrow Page 2 - Animation in OpenGL for Game Programmi...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
OLM
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MULTIMEDIA

Animation in OpenGL for Game Programming using SDL
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2007-08-28

    Table of Contents:
  • Animation in OpenGL for Game Programming using SDL
  • The Basics Continued: Coordinate Spaces
  • Animation APIs in OpenGL
  • Animation: a Basic Example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    The Web Buyer's Guide is your best source for white papers on a wide range of IT products and services. This Week's Featured White Papers: Help Simplify Virtualization by IBM

    Animation in OpenGL for Game Programming using SDL - The Basics Continued: Coordinate Spaces
    (Page 2 of 4 )

    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


       · In this article I have discussed about using OpenGL API for animation using SDL for...
     

       

    MULTIMEDIA ARTICLES

    - 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

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway