Jump to content
  • Advertisement
Sign in to follow this  
p_ooya

JOGL: Strange behaviour with color material for an obj model

This topic is 2529 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

For a project with a 3d model I was given an Autocad file. I imported the file in 3ds max and exported it as .obj file. So far so good. But when I load this file into my Jogl application, I have a strange problem with color material. Te be more precise, look at the images below. The first one is an screenshot from my application and the second one, is a screenshot of the exactly the same file loaded into a 3d manipulation software.

How it looks like:

6I3xP.png

How it should look like (exactly the same file loaded in milkshape3d)

DJlH7.png

Moreover, when I add the classical teapot to the scene, it is shown very good without any problem (I mean the light and material are ok). Here is part of my code:

gl.glNewList(1, gl.GL_COMPILE);
for (int i = 0; i < len; i=i+3) {

gl.glBegin(GL.GL_TRIANGLES);

gl.glTexCoord2f(body.body_textCoords[0], body.body_textCoords[1]);
gl.glNormal3f(body.body_normal[0], body.body_normal[1], body.body_normal[2]);
gl.glVertex3f(body.body_vertex[0], body.body_vertex[1], body.body_vertex[2]);

gl.glTexCoord2f(body.body_textCoords[i+1][0], body.body_textCoords[i+1][1]);
gl.glNormal3f(body.body_normal[i+1][0], body.body_normal[i+1][1], body.body_normal[i+1][2]);
gl.glVertex3f(body.body_vertex[i+1][0], body.body_vertex[i+1][1], body.body_vertex[i+1][2]);

gl.glTexCoord2f(body.body_textCoords[i+2][0], body.body_textCoords[i+2][1]);
gl.glNormal3f(body.body_normal[i+2][0], body.body_normal[i+2][1], body.body_normal[i+2][2]);
gl.glVertex3f(body.body_vertex[i+2][0], body.body_vertex[i+2][1], body.body_vertex[i+2][2]);
gl.glEnd();
}
gl.glEndList();


Any ideas?

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!