Jump to content
  • Advertisement
Sign in to follow this  

can openGL be used for animation...and what is SDL ???

This topic is 3068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi guys , i'm totally new to this site and ofcourse new to openGL programing(u can tell by the subject). I am comfortable with C/C++ programming. I want to concentrate in 3d animation. I know most of u guys are into game programming. But I am more in or animation and art (plese dont kick my ass). I am currently at my junior year and im studying computer science and engineering. I am totally new to the graphics stuffs. I am more into designing and art. By that I mean I am not aiming for game programming...I am more into animations and 3d graphic designing. I want to do a masters on visualization. I am already into photoshop n maya. But I do not want to leave my programming knowledge behind. Everyone is saying that openGL is dead.I am really confused. And also would you guys please tell the "actual" difference between softwares like maya and the programming languages such as openGL. I know they are different but what are the different applications. Is animation done by openGL? Y do ppl keep saying taht openGL is not good enough. If it's dead what should I learn? what should i satrt off by ?? Please HELP !!!!

Share this post

Link to post
Share on other sites
I wouldn't say OpenGL is dead, although it shouldn't ignore the fast growing DirectX API. For learning purposes, OpenGL is still great. And you can still make an AA game with it as well.

Anyway, yes you can do animations with OpenGL or DirectX. But, they are not integrated by default. If you start searching for animation or bone functions in OpenGL, you will find none. Doing animations is all about applying matrix or quaternion transformations on a 3D mesh. Pretty difficult stuff, I'll warn you. I've spend the last 3 weeks fighting with it :)

First, learn how to render and import a 3D mesh (without animations). There are several tutorials (on Nehe for example) that shows you how to make a mesh class structure and load data from OBJ or other kind of file formats. Ussually the mesh is a listing of vertices, texture coordinates, normals and indices that connect the vertices (triangles). OpenGL has several functions to pass these data array's so your mesh will get rendered. The most difficult part here probably lies in making the importer. File formats that also hold animation data can be pretty complex. Not all of them though, Milkshape's MS3D format for example is pretty easy. Check out www.wotsit.org for file format descriptions.

Once you can render a static mesh, you can proceed with the animations. Assuming you want skeleton animations, pick a file format that holds the sekeleton and keyframe data. You could eventually combine files. In my case I use Lightwave objects mostly for the mesh, but I use MS3D files for the animation part. The skeleton is ussually a tree-structure of joints:

Keyframe = class
time : float
transformation : matrix / quaternion

Joint = class
name : string;
initialMatrix / initialQuaternion
children : array of Joint; // sub bones

keyframes : array of Keyframe;

Then start adding animations. An animation is typically a skeleton where each bone/joint has a listing of keyframes. Keyframes tell how to transform the joint over time.

First try to import and visualize the skeleton (not the mesh) by drawin lines for example. When that works, you'll bind your mesh vertex data to the joints. Each vertex points to 1 or a few bones, eventually with so called weights that tell how much influence each bone has. With this data, you can can transform the vertex into the current skeleton frame.

I whish I had a simple demo somewhere, but I don't know any except the nVidia SDK demo's. They use vertex shaders to transform the vertices though. Although the principle is the same, I guess CPU transformations are easier to start with. That means the CPU calculates where each vertex should be, each frame.

1- Import a mesh file and render it
2- Import skeleton and keyframe data
3- Animate the skeleton and use interpolation to get the matrix for each joint between 2 keyframes
4- Render the skeleton to test it
5- Attach vertices to the bones (or vice versa).
6- After calculating the resulting bone matrices for a certain frame, apply these transformations on their attached vertices.
7- Render mesh with transformed vertices as an end result

Good luck,

Share this post

Link to post
Share on other sites
Design mostly. In glut you register functions that handle keyboard input mouse input etc. In SDL you poll for events. As an example if you want to handle keyboard input you would call poll then inspect the event to see if it was a keyboard event then do something with it. I find the SDL model a easier to use because I have more control, but as always more control means more work.

Share this post

Link to post
Share on other sites
I never used SDL, but probably you can't really compare the two. Let's say OpenGL itself is the core, providing a huge list of functions to draw 3D stuff and drive the videocard. GLUT is a small utility that easifies drawing on Windows forms. Just a few functions to help you out. It has a few other functions to draw primitives, and some other basic functions. Often used to setup your project quickly and/or do some demo things like drawing the good old teapot.

SDL seems to cover a much wider range of functions, including setting up viewers both on Windows and Linux forms. But it also delivers audio, (image) file loadig functions, 2D graphics, keyboard input, and so on.

A little bit like DirectX. DirectX is more than 3D, it also takes care of audio, input, 2D and other typical media/game related stuff. Direct3D is the 3D rendering component of DirectX. As for SDL, OpenGL would be the 3D rendering component.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!