Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

JOGL: Strange behaviour with color material for an obj model

4: Adsense

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
1 reply to this topic

#1 p_ooya   Members   

100
Like
0Likes
Like

Posted 15 January 2012 - 01:59 PM

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:

Posted Image

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

Posted Image

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[i][0], body.body_textCoords[i][1]);
			gl.glNormal3f(body.body_normal[i][0], body.body_normal[i][1], body.body_normal[i][2]);
			gl.glVertex3f(body.body_vertex[i][0], body.body_vertex[i][1], body.body_vertex[i][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?

#2 p_ooya   Members   

100
Like
0Likes
Like

Posted 15 January 2012 - 02:20 PM

Problem solved. The problem was that Normals were not normalized. GL_NORMALIZE did the job.




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.