Hi,

I've just started reading about OpenGL and I found out that this is a really low level api. I've created some simple 2d games in xna and sfml and now I want to try my hands at 3d and OpenGL. I've already learned that I can't simply load a 3d model like a texture and I have to make a simple program that would read the information from such a file into the memory. But I a also come up with some questions:

1) Let's say I want to use a simple model of a human in my 3d game. How can I solve the problem of movement of his arms and legs? (of course just the basics, not the real-life smooth movement) Should I prepare a set of models in 3d graphic program or is it better to transform it somehow in my game? Should each element of a leg/arm be a different model?

2) Probably a game engine would be helpful. Which way do I provide the information about how to move this arm/leg in an engine?

3) Are there any free 3d game engines for OpenGL that should particularly be recommended?

Bye

Hi there. I'm into pretty much the same thing as you, and I have been thinking alot about loading and moving a 3D character around. In my opinion, the simplest way to do this is to draw all body parts separately. When loading them in OpenGL, you should check out something called display lists. The next step is to create a skeleton, just like a stick figure of nodes. The structure could look something like this:

TORSO NODE {
   HEAD NODE {}
   LEFT UPPER ARM NODE {
      LEFT LOWER ARM NODE {}
   }
   RIGHT UPPER ARM NODE {
      RIGHT LOWER ARM NODE {}
   }
   PELVIS NODE {
      LEFT UPPER LEG NODE {
         LEFT LOWER LEG NODE {}
      }
      RIGHT UPPER LEG NODE {
         RIGHT LOWER LEG NODE {}
      }
   }
}

From this structure each connection between nodes can be made out, like the torso has connections to head, left and right upper arms and pelvis. Now define points on your models that should match the corresponding skeleton nodes at all times. Your skeleton should be made so that when a node is moved, all its child nodes has to be moved accordingly so they are still attached to their parents.

When it comes to animation, I suggest using a keyframe system. For example, you divide your walk-cycle into 6-12 keyframes, where you position your skeleton in different poses to make a complete walk-cycle. Then you simply let the computer calculate the coordinates of your nodes for all the frames between the keyframes.

It can be a bit tricky to make all this work, and I'm not really sure whether this is even close to convetional methods. However, I feel that the possibilities are many once you get this working. When you have a completely animated skeleton and working methods that map your display lists of body parts to the skeleton, you can easily make changes in your character in any way you want. For example you can choose to switch the torso model to another (changing an armor of a warrior for example), or having different head models for different characters and so on. If done correctly, it should also be really easy to split your skeleton-tree into two trees (like chopping of an arm).

All I provided are just rough abstractions, so I'll leave the real job to you. I'm sorry but I can't answer your questions about pre-made game engines. All I know of is a free engine called Irrlicht that support OpenGL.

Good luck to you on your 3D-ing!
Emil Olofsson

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.