Try
setting the transparencyAttriburtes obj to new
TransparencyAttributes(TransparencyAttributes.BLENDED, 1.0f)
and
setting the texture mode in the texture attributes object to
REPLACE.
-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Corysia Taware
Sent: Monday, September 10, 2001 3:13 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] BufferedImage, again...Well, I'm not any closer. This is what I have now:TextureLoader textureLoader = new TextureLoader(filename, this);
BufferedImage texBuff = textureLoader.getImage().getImage();Texture texture = textureLoader.getTexture();
int width = texture.getWidth();
int height = texture.getHeight();// this is the new image we're going to make
BufferedImage buffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++) {
int rgb = texBuff.getRGB(x, y);
int a = 128; // 50% alpha
byte bytes[] = Convert.intToBytes(rgb);
System.out.print("[" + bytes[0] + "," + bytes[1] + "," + bytes[2] + "," + bytes[3] + "] becomes ");
int rgba = rgb + (a << 24);
buffer.setRGB(x, y, rgba);bytes = Convert.intToBytes(buffer.getRGB(x, y));
System.out.println("[" + bytes[0] + "," + bytes[1] + "," + bytes[2] + "," + bytes[3] + "].");
}
texture = new Texture2D(Texture2D.BASE_LEVEL, Texture2D.RGBA, width, height);
texture.setImage(0, new ImageComponent2D(ImageComponent2D.FORMAT_RGBA, buffer));My output looks like this:[-1,0,0,0] becomes [127,0,0,0].
[-1,0,0,0] becomes [127,0,0,0].
[-1,0,0,0] becomes [127,0,0,0]....etc...It sure looks to me like the alpha value is set, but my texture remains opaque. I've verified that I am using this generated texture by changing 'rgba' to '0' and 'Integer.MAX_VALUE - 1' and got the results I expected (opaque black and white textures, respectively).
