Sign in to follow this  
MatsK

Drawing skeleton dots

Recommended Posts

I'm trying to render a number of vertices (dots) in order to ensure that my skeleton is setup correctly. But I can't figure out how to do the equivalent of:

[code]static void DrawBonesSkeleton(Bone_t& Bone)
{
glPointSize(5.0);
glTranslatef(Bone.Translation.x, Bone.Translation.y, Bone.Translation.z);
float RotationMatrix[16];
FindQuaternionMatrix(RotationMatrix, &Bone.Rotation);
glMultMatrixf(RotationMatrix);

if(!strcmp(Bone.Name, "ROOT"))
glColor3f(1.0, 0.0, 0.0);
else if(!strcmp(Bone.Name, "HEAD"))
glColor3f(1.0, 1.0, 0.0);
else
glColor3f(0.0, 1.0, 0.0);
glBegin(GL_POINTS); glVertex3f(0, 0, 0); glEnd();

if(Bone.ChildrenCount == 1){
DrawBonesSkeleton(*Bone.Children[0]);
}else if(Bone.ChildrenCount > 1){
for(unsigned i=0; i<Bone.ChildrenCount; i++){
glPushMatrix();
DrawBonesSkeleton(*Bone.Children[i]);
glPopMatrix();
}
}
}

static void DrawSkeleton()
{
glPushMatrix();
DrawBonesSkeleton(Skeleton.Bones[0]);
glPopMatrix();
}[/code]

in XNA - my current attempt involves one call to DrawUserPrimitives() when rendering, but the output obviously isn't correct because DrawBonesSkeleton is a recursive function. Please, if you have any ideas - reply!

Edit: Why isn't the entire code displayed?
Edit2 by Hodgman: We seem to be having some bugs with the [font=courier new,courier,monospace]source[/font] tag at the moment, the [font=courier new,courier,monospace]code[/font] tag still seems to work though...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this