Jump to content
  • Advertisement
Sign in to follow this  
CyanPrime

Errors displaying MD5MESH file in Java

This topic is 2527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been working on creating a MD5 model viewer in Java, and while I've managed to read the data, and format it I can't for the life of me figure out why I can't display it properly. I'm following the instructions here. but it's just giving me a garbled mess. Can anyone help me? First I'd like to post the important parts of my code:

private void render(){
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT |
GL11.GL_DEPTH_BUFFER_BIT);
GL11.glLoadIdentity();

GL11.glTranslatef(0, 0, -500);
GL11.glColor3f(1.0f, 1.0f, 1.0f);//white
int meshNum = 0;
texture.bind();
GL11.glBegin(GL11.GL_TRIANGLES);
for(int i = 0; i < model.meshes.get(meshNum).numTris; i++){
Tri t = model.meshes.get(meshNum).tris.get(i);

GL11.glTexCoord2f(0,0); GL11.glVertex3f(model.vertices.get(t.vert1).x,model.vertices.get(t.vert1).y,model.vertices.get(t.vert1).z);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(model.vertices.get(t.vert2).x,model.vertices.get(t.vert2).y,model.vertices.get(t.vert2).z);

GL11.glTexCoord2f(1,1); GL11.glVertex3f(model.vertices.get(t.vert3).x,model.vertices.get(t.vert3).y,model.vertices.get(t.vert3).z);

}
GL11.glEnd();
}


And

public void computeVertices(Mesh m){
for(int i = 0; i < m.numVerts; i++){
Vector3f pos = new Vector3f(0,0,0);
int start = m.verts.get(i).weightIndex;
int count = m.verts.get(i).weightElement;

for(int j = count; j < count + start; j++){
Joint joint = joints.get(m.weights.get(j).jointIndex);
Vector3f temp = joint.pos;
Vector3f wt = applyQuat(m.weights.get(j).pos, joint.orient);
Vector3f.add(temp, wt, temp);
temp.scale(m.weights.get(j).value);
Vector3f.add(pos, temp, pos);
}

vertices.add(pos);
}
}



My blog I set up just now has more links, like the full source code, and what not. I don't want to link all those links here cause I think it'd be too many links, so I'll just direct you to here if you need more info.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!