PDA

View Full Version : skeleton animation



imclumsy04
03-20-2010, 07:27 AM
Hi!

I am really really new to opengl and I prefer to do my programming in java opengl. What I am trying to do is build a skeleton with a head, torso, arms, and legs with quadrics. I googled a bit and some links said to make a joint class and a main class and start from there. Currently I am trying to read from a .skel file and create the skeleton from the given data. Here are the contents of the .skel file (which basically a text file) and here is my joint class.

.skel file:

root
Offset: [0.0, 0.0, 0.0]
Boxmin: [-0.2, -0.3, -0.15]
Boxmax: [0.2, 0.3, 0.15]

head
Offset: [0.0, 0.3, 0.0]
Boxmin: [-0.1, 0.0, -0.1]
Boxmax: [0.1, 0.2, 0.1]

hip_l
Offset: [-0.1, -0.3, 0.0]
Boxmin: [-0.05, -0.3, -0.05]
Boxmax: [0.05, 0.0, 0.05]

knee_l
Offset: [0.0, -0.3, 0.0]
Boxmin: [-0.05, -0.3, -0.05]
Boxmax: [0.05, 0.0, 0.05]

hip_r
Offset: [0.1, -0.3, 0.0]
Boxmin: [-0.05, -0.3, -0.05]
Boxmax: [0.05, 0.0, 0.05]

knee_r
Offset: [0.0, -0.3, 0.0]
Boxmin: [-0.05, -0.3, -0.05]
Boxmax: [0.05, 0.0, 0.05]

Joint class:



import com.sun.opengl.util.Animator;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;
import java.io.*;
import java.util.*;

public class SkeletonJoint {
String name = " ";
float[] offset = new float[3];
float[] boxmin = new float[3];
float[] boxmax = new float[3];
float[] pose = new float[3];

public SkeletonJoint() {

}

public void setName(String Jname) {
name = Jname;
}

public String getName() {
return name;
}

public void setOffset(float x, float y, float z) {
offset[0] = x;
offset[1] = y;
offset[2] = z;
}

public float[] getOffset() {
return offset;
}

public void setBoxMin(float x, float y, float z) {
boxmin[0] = x;
boxmin[1] = y;
boxmin[2] = z;

}

public float[] getBoxmin() {
return boxmin;
}

public void setBoxMax(float x, float y, float z) {
boxmax[0] = x;
boxmax[1] = y;
boxmax[2] = z;

}

public float[] getBoxmax() {
return boxmax;
}

public void setPose(float x, float y, float z) {
pose[0] = x;
pose[1] = y;
pose[2] = z;

}

public void draw() {
// Gl gl = = drawable.getGL();
}

public float[] getPose() {
return pose;
}

}


Where do I go from here?

Ehsan Kamrani
03-20-2010, 08:20 AM
It seems that you want to use skeletal based animations. First of all you need to learn about skeletal based animations.
Here you can find good references:

CSE169-Winter 2008 (http://graphics.ucsd.edu/courses/cse169_w08/reading.html)
Download and read chapters 2 and 3 of this course( They are free ).
Note that these chapters have used "raw major matrices" instead of column major matrices.

Dealing with non-skeletal based animations is really easier. The most difficult part of skeletal based animations is the "skinning" subject.

If you are really new to OpenGL, you won't be able to draw the skin of skeleton. You need to read some books and articles about OpenGL first...