Author Topic: [solved] transparent texture with alpha blending  (Read 5547 times)

Offline yindroid

  • byte
  • *
  • Posts: 21
    • View Profile
[solved] transparent texture with alpha blending
« 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!
« Last Edit: November 02, 2011, 12:38:23 pm by yindroid »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: transparent texture with alpha blending
« Reply #1 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.

Offline yindroid

  • byte
  • *
  • Posts: 21
    • View Profile
Re: transparent texture with alpha blending
« Reply #2 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);