[solved] transparent texture with alpha blending

Started by yindroid, October 31, 2011, 04:51:47 PM

Previous topic - Next topic

yindroid

Hi, gyus. I'm new here.
At first I have to thanks jPCT creator for fantastic work, it looks promising.
About my problem, what is the proper way to get textures with alpha blending works? I use png with alpha chanel, but result is not  what I expected(only black areas ar transparet) This is my code:

//loading texture
TextureManager.getInstance().addTexture("panda", new Texture(getBitmapFromAssetsARGB8888(256,256,"gfx/alpha.png", AppContext));

//seting up 3dobject
planePanda = Primitives.getPlane(1, 10);
planePanda.setTexture("panda");
planePanda.setTransparency(3); //not sure how it works
planePanda.build();
world.addObject(planePanda);


Thanks!

EgonOlsen

By default, jPCT creates an alpha channel based on the pixel information in the texture. If you want to use the alpha channel from the file, just use one of the Texture(...., useAlpha); constructors instead.

yindroid

according your addvice, I added argument useAlpha, and it works!  Thank You!!! 

TextureManager.getInstance().addTexture("panda", new Texture(getBitmapFromAssetsARGB8888(256,256,"gfx/alpha.png", AppContext), true);