I have to implement a man running using opengl but I have no idea how to do it, I am a beginner.
I have a mesh (file ANI) containing the faces, the vertexes and all the frames which needs for the movements.
And I have the texture on a PCX file.
Having the mesh with texture loaded, I need to make him run using the arrow_up key.
Is there anybody who can help me ot give me some opensource code about it?
P.S. I have already loaded the faces, vertexes and frames in the data structure which is made a arrays
I don’t know any ANI format. Animating it all depends on how the frames are defined.
The way I see it, you can have three methods:
- A whole set of independent geometry for every frame. In that case, just render everything with a matching frame number. Morphing between frames is hell, because there is by definition no way of knowing which bit of geometry in one frame corresponds to one in a different frame.
- Vertices are linked to transformation matrices (or positions and rotations), and the matrices are stored per frame. I believe the 3DS format uses something like this. Interpolation is doable, especially if the matrices are stored as positions and rotations or as quaternions.
- Vertices are linked to one or multiple joints. Pretty much the same idea as 2, but joints are also linked to each other. So rotating a shoulder also rotates the fingers. You can use matrix push/multiply/pop to simplify things.
You’ll have to find out which it is.