Try to load your image with transparency as "RGBA" instead "RGB"
----- Original Message -----
From: "chris Thorne" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 27, 2003 2:24 AM
Subject: [JAVA3D] Help please with multi tesxturing
> Hi,
> I am trying to apply one texture with transparency over another. The
> base texture does not
> show through where the top texture has transparency. Here is the simple
> test code fragment I am using to
> test it. Anyone spot the problem?
>
>
> thanks,
>
> chris
> ...
> // Create appearance object for textured tristrip
> Appearance app = new Appearance();
>
> Texture tex = new TextureLoader("world.gif", "RGB", new
> Container()).getTexture();
> TextureAttributes texAttr = new TextureAttributes();
> texAttr.setTextureMode(TextureAttributes.MODULATE);
>
> // Create second texture unit
> Texture tex2 = new TextureLoader("swbSmall.gif", "RGB", new
> Container()).getTexture();
> TextureAttributes texAttr2 = new TextureAttributes();
> texAttr2.setTextureMode(TextureAttributes.DECAL);
>
> TextureUnitState tus1= new TextureUnitState(tex, texAttr, null);
> TextureUnitState tus2= new TextureUnitState(tex2, texAttr2, null);
>
> TextureUnitState[] textureUnits = new TextureUnitState[2];
> textureUnits[0] = tus1;
> textureUnits[1] = tus2;
>
> app.setTextureUnitState(textureUnits);
>
> BranchGroup objRoot = new BranchGroup();
>
> TransformGroup sceneNavTg = new TransformGroup();
>
> // create the geometry
> int vertexCounts[] = {4};
> int texCoordSetMap[] = {0,1};
>
> IndexedTriangleStripArray tri = new IndexedTriangleStripArray(4,
> GeometryArray.COORDINATES |
> GeometryArray.TEXTURE_COORDINATE_2, 2, texCoordSetMap, 4, vertexCounts);
> float txtr0[] = {0f,1f, 0f,0f, 1f,1f, 1f,0f};
> float txtr1[] = {0f,0.5f, 0f,0f, 0.5f,0.5f, 0.5f,0f};
> double coords0[] = {0,0,0, 0,0,1, 1,0,0, 1,0,1};
> int indices[] ={0, 1, 2, 3};
> int indices2[] ={0, 1, 2, 3};
> tri.setTextureCoordinateIndices(0,0, indices);
> tri.setTextureCoordinateIndices(1,0, indices2);
> tri.setCoordinateIndices(0, indices);
> tri.setTextureCoordinates(0, 0, txtr1);
> tri.setTextureCoordinates(1, 0, txtr0);
>
> tri.setCoordinates(0, coords0);
>
> Shape3D shape = new Shape3D(tri,app);
> sceneNavTg.addChild(shape);
> objRoot.addChild(sceneNavTg);
>
> ...
>
>
===========================================================================
> 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".
_______________________________________________________________________
Busca Yahoo!
O servi�o de busca mais completo da Internet. O que voc� pensar o Yahoo! encontra.
http://br.busca.yahoo.com/
===========================================================================
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".