www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: yindroid on October 31, 2011, 04:51:47 pm

Title: [solved] transparent texture with alpha blending
Post by: yindroid on October 31, 2011, 04:51:47 pm
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:
Code: [Select]
//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!
Title: Re: transparent texture with alpha blending
Post by: EgonOlsen on October 31, 2011, 07:49:44 pm
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.
Title: Re: transparent texture with alpha blending
Post by: yindroid on October 31, 2011, 11:16:37 pm
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);