Jump to content

  • Log In with Google      Sign In   
  • Create Account

Drawing skeleton dots


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 MatsK   Members   -  Reputation: 226

Like
0Likes
Like

Posted 07 July 2012 - 08:39 PM

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:

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();
}

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 source tag at the moment, the code tag still seems to work though...

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS