Hello Bassam,
I recently had a problem with a texture on a
rectangle polygon.
I could not solve a problem with rendered the
texture color depth on my computer.
However it looks well on other computers, so I
think I have a problem with the graphics driver.
Thank for all people who helped me.
Here is the code, it might help with
your problem:
QuadArray qa = new QuadArray( 8, QuadArray.COORDINATES | QuadArray.TEXTURE_COORDINATE_2 | QuadArray.NORMALS); x_corner = 735.0f; y_corner = 560.0f; z_plane = image * CellLine.zScale; float coords[] = { x_corner, y_corner, z_plane, 0.0f, y_corner, z_plane, 0.0f, 0.0f, z_plane, x_corner, 0.0f, z_plane, x_corner, y_corner, z_plane, x_corner, 0.0f, z_plane, 0.0f, 0.0f, z_plane, 0.0f, y_corner, z_plane }; /*float textcoords[] = { 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; */ float textcoords[] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; float normals[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f }; qa.setCoordinates(0, coords); qa.setTextureCoordinates(0, textcoords); qa.setNormals(0, normals); Appearance app = new Appearance(); TextureAttributes texAttr = new TextureAttributes(); app.setCapability(Appearance.ALLOW_TEXTURE_WRITE); app.setCapability(Appearance.ALLOW_TEXTURE_READ); texAttr.setTextureMode(TextureAttributes.REPLACE); //texAttr.setPerspectiveCorrectionMode(TextureAttributes.NICEST); //System.out.println(texAttr.getTextureColorTableSize()); app.setTextureAttributes(texAttr); if (transparent) { texAttr.setTextureMode(TextureAttributes.MODULATE); app.setTransparencyAttributes( new TransparencyAttributes( TransparencyAttributes.FASTEST, 0.1f)); } /*Material mm = new Material(); mm.setLightingEnable(false); //mm.setLightingEnable(true); app.setMaterial(mm); app.setColoringAttributes( new ColoringAttributes( new Color3f(1.0f, 1.0f, 1.0f), //ColoringAttributes.FASTEST)); ColoringAttributes.NICEST));*/ appearances[image - minSlice] = app; imageSwitch.addChild(new Shape3D(qa, app)); Chris
----- Original Message ----- From: Bassam To: [EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 11:04 PM Subject: [JAVA3D] texture problem I have a 4 vertix planar polygon (not a square ,because the base is much longer) The problem is when I apply this texture on it ,the straight lines will be bent in a strange way...take a look at the two pictures the texture coordinates are: upper left vertix lower left vertix lower right vertix upper right vertix Tell me what do you think I should do?? Bassam =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". |
- Re: [JAVA3D] texture problem Bassam
- Re: [JAVA3D] texture problem T.J.Hunt
- Re: [JAVA3D] texture problem Chris Ender
- Re: [JAVA3D] texture problem Bassam