bvh hell

B

bob

I'm trying to write a BVH file loader to get my feet wet with skeletal
animation, and I'm having a lot of trouble getting it working.

I can get the skeleton to draw, and he moves around a little bit.
However, the motion just isn't right. I must be doing the angles or
something wrong.

Please let me know if you see anything obviously wrong with the drawing
code:

struct Joint {
char name[80];
float offset[3];
int numchannels;
vector<Joint> v;
};

void drawwell(Joint j)
{
vector<Joint>::iterator iter = j.v.begin();
int fctr = mikectr % frames.size();
if (j.numchannels == 3) {
glPushMatrix();
glRotatef(0, 0, 1, frames[fctr][globalctr]);
glRotatef(1, 0, 0, frames[fctr][globalctr+1]);
glRotatef(0, 1, 0, frames[fctr][globalctr+2]);
glTranslatef(j.offset[0], j.offset[1], j.offset[2]);
glBegin(GL_POINTS);
glVertex3f(0, 0, 0);
glEnd();
globalctr+=j.numchannels;
while (iter != j.v.end()) drawwell(*iter++, 0, 0, 0);
glPopMatrix();
}
else
{
// this is for the root node
globalctr+=j.numchannels;
glPushMatrix();
glRotatef(0, 0, 1, frames[fctr][globalctr+3]);
glRotatef(1, 0, 0, frames[fctr][globalctr+4]);
glRotatef(0, 1, 0, frames[fctr][globalctr+5]);
glTranslatef(j.offset[0], j.offset[1], j.offset[2]);
glBegin(GL_POINTS);
glVertex3f(0, 0, 0);
glEnd();
while (iter != j.v.end()) drawwell(*iter++);
glPopMatrix();
}
}
 
V

Victor Bazarov

I'm trying to write a BVH file loader to get my feet wet with skeletal
animation, and I'm having a lot of trouble getting it working.

I can't find "BVH" in the C++ Standard. What is it? How is it related
to the subject of this newsgroup?
I can get the skeleton to draw, and he moves around a little bit.
However, the motion just isn't right. I must be doing the angles or
something wrong.

How is it a C++ language problem?
Please let me know if you see anything obviously wrong with the drawing
code:

struct Joint {
char name[80];
float offset[3];
int numchannels;
vector<Joint> v;
};

void drawwell(Joint j)

Here is something that could improve it ever slightly: pass by reference

void drawwell(Joint const& j)
{
[...OpenGL-specific stuff snipped...]
}

Did you mean to post this to comp.graphics.api.opengl?

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top