Multimedia
  Home arrow Multimedia arrow Page 2 - Animation in OpenGL for Game Programming using SDL
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 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? 
Google.com  
MULTIMEDIA

Animation in OpenGL for Game Programming using SDL
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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
     

       

    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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek