Hierarchical Models? Help!

I’ve written .MD2 file viewer, now When I load Character and it’s Weapon file, and display it at it’s initial coordinates, it displays file, like chracter holding the weapons, problems is that when character is animated, moved, how you can move weapon with character’s hand, in 3D Studio you can make child objects, like attach weapons to character’s hand, so where the hands move the weapon moves, does anything similar can be implemented in OpenGL ?

you can do that through glPushMatrix(), glPopMatrix()

example :

rotateUpperbody()
glPushMatrix();
rotaterightShoulder
glPushMatrix();
rotaterightelbow();
glPopMatrix();
glPopMatrix(); --> back to upper body matrix
glPushMatrix();
glrotateleftshoulder()l
glPushMatrix();
glRotateleftelbow();
glPopMatrix();
glPopMatrix(); --> back to upper body again