PDA

View Full Version : OpenGL >> Adding branches to skeletal joints



Salcybercat
05-08-2011, 10:17 AM
Hi, I'm new to openGL, I need some help in understanding how to allow users to interactively add branches (bones) to already-existing joints of a skeleton. The joints in my program now is already in the form of a recursive joint hierarchy (refer to code below):



void display(void)
{

glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glColor3f(1.0, 0.0, 1.0);
root();
glColor3f(1.0, 0.0, 0.0);
glTranslatef(0.0, ROOT_HEIGHT, 0.0);
shoulder();
glColor3f(0.0, 1.0, 0.0);
glTranslatef(0.0, SHOULDER_HEIGHT, 0.0);
elbow();
glColor3f(0.0, 0.0, 1.0);
glTranslatef(0.0, ELBOW_HEIGHT, 0.0);
wrist();
glFlush();
glutSwapBuffers();
}

I'm not sure how exactly to allow the user to choose and attach a new bone to a joint. Any suggestions are much appreciated, thanks!