• Advertisement

p_ooya

Member
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

100 Neutral

About p_ooya

  • Rank
    Newbie
  1. Problem solved. The problem was that Normals were not normalized. GL_NORMALIZE did the job.
  2. 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: [img]http://i.stack.imgur.com/6I3xP.png[/img] How it should look like (exactly the same file loaded in milkshape3d) [img]http://i.stack.imgur.com/DJlH7.png[/img] 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: [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();[/CODE] Any ideas?
  3. Hello everyone. Hope this is the right place for this question. I'm relatively new to java3d and I'm having a problem. I want to assign a texture (an image) to an obj 3d model. The problem is, when I run the code the model is loaded correctly but the texture is not assigned correctly. More accurately, the whole 3d model has a single color instead of an image as texture. Mentioned color, is the color of the pixel at bottom-left of the image. Here is the code: [code]Shape3D torus=null; Scene t1 = getSceneFromFile("Some local path\torus.obj"); \*Grabbing the model from the scene*\ BranchGroup branchGroup = t1.getSceneGroup(); torus = (Shape3D) branchGroup.getChild(0); \*loading the image, generating the texture and making the appearance*\ TextureLoader textureLoader=new TextureLoader("Another local path\myImage.jpg",null); ImageComponent2D image=textureLoader.getImage(); Texture2D texture=new Texture2D(Texture.BASE_LEVEL,Texture.RGBA,image.getWidth(),image.getHeight()); texture.setImage(0, image); Appearance app = new Appearance(); app.setTexture(texture); torus.setAppearance(app); [/code] How to solve this issue?
  • Advertisement