objects-childs-parents

if i have a cube and a sphere an i want the cube to be the parent object and the sphere the child object how can i do it?Can someone gives me a sample code and explain i a few words what is the difference between a parent and a child object?

All you simply do is not pop your matrix, or at least not pop your translation matrix.
(Can’t remember the right command right now).

Then just place your second object.
Example:

void DrawArm() {
glPushMatrix();
{
glTranslatef(arm->x, arm->y, arm->z);
glRotatef(arm->xr, 1.0, 0.0, 0.0);
glRotatef(arm->yr, 0.0, 1.0, 0.0);
glRotatef(arm->zr, 0.0, 0.0, 1.0);
glCallList(arm);
glPushMatrix();
{
glTranslatef(larm->x, larm->y, larm->z);
glRotatef(larm->xr, 1.0, 0.0, 0.0);
glRotatef(larm->yr, 0.0, 1.0, 0.0);
glRotatef(larm->zr, 0.0, 0.0, 1.0);
glCallList(larm);
}
glPopMatrix();
}
glPopMatrix();
}

This type of linking/animation is the opposite of IK which you probably know from 3DS Max.

Good Luck.

[This message has been edited by Red15 (edited 01-07-2003).]

[This message has been edited by Red15 (edited 01-07-2003).]

[This message has been edited by Red15 (edited 01-07-2003).]