Hi,
I create a triangle and set the texture coordinate. Then I put the
texture on it. However, after I do a transformation, the triangle is
transformed and the texture is not tranformed following the triangle.
Is there anybody can tell me how to bind the texture with the triangle
together? Do I need to transform the texture? I guess the problem is
in the method to create the appearance.
The following is my code to create the appearance:
private void createAppearance() {
Appearance app = new Appearance();
// blended transparency so texture can be irregular
TransparencyAttributes tra = new TransparencyAttributes();
tra.setTransparencyMode(TransparencyAttributes.BLENDED);
app.setTransparencyAttributes(tra);
// mix the texture and the material colour
TextureAttributes ta = new TextureAttributes();
ta.setTextureMode(TextureAttributes.MODULATE);
app.setTextureAttributes(ta);
// load and set the texture
// System.out.println("Loading textures from " + TEX_FNM);
TextureLoader loader = new TextureLoader(TEX_FNM, null);
Texture2D texture = (Texture2D) loader.getTexture();
app.setTexture(texture); // set the texture
Material mat = new Material(.....);
mat.setLightingEnable(true);
app.setMaterial(mat);
setAppearance(app);
}
Thank you in advance!
Looking forward to hearing from you!
Regards,
James
BADBOY - 24 Aug 2004 23:51 GMT
Hi, I suspect the problem lies within the texture coordinates of the
GeometryArray.
J3d has been put to 1 side for a while for me so cant remember explicitly
what todo,
Have a look at the source for TextureCoordinateGenerator and particularly
the texture stuff in LWLoader source
thats how i originally got my head round texture coordinates.
hope that helps
John
> Hi,
>
[quoted text clipped - 39 lines]
>
> James
BADBOY - 26 Aug 2004 23:14 GMT
More specifically it sounds like u are using automitac
TextureCoordinateGenerator and
hav set EYE_LINEAR as thats exactly what thats meant todo.
> Hi, I suspect the problem lies within the texture coordinates of the
> GeometryArray.
[quoted text clipped - 55 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004