Author Topic: Constructor Texture(*, boolean useAlpha). useAlpha not work?  (Read 2138 times)

Offline platte

  • byte
  • *
  • Posts: 3
    • View Profile
Constructor Texture(*, boolean useAlpha). useAlpha not work?
« on: March 08, 2012, 12:49:07 pm »
Hi,  I have a png with alpha. when i use constructor of Texture(Bitmap, true). But the transparent is just black. But when I set the object3D's transparent to any NO zero value. It works. Why?. My code like these:

InputStream image = mContext.getResources().openRawResource(R.raw.test);
final Texture texture = new Texture(test, true);// useAlpha NOT work no matter whar true or false
TextureManager.getInstance().addTexture(mSceneGrass, texture);
Object3D[] objs = Loader.load3DS( LoadAssets.loadf(mContext, "test.3DS"), 1f);
objs[0].setTransparency(128);//it work
objs[0].setTexture(mSceneGrass);

When I remove objs[0].setTransparency(128);
The transparent is always black.

Thanks.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12297
    • View Profile
    • http://www.jpct.net
Re: Constructor Texture(*, boolean useAlpha). useAlpha not work?
« Reply #1 on: March 08, 2012, 06:42:43 pm »
That's by design...an alpha can't have an effect if blending isn't enabled. And that is done by calling setTranspareny with any value other than -1.

Offline platte

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Constructor Texture(*, boolean useAlpha). useAlpha not work?
« Reply #2 on: March 09, 2012, 01:44:06 am »
Yes.I am newer.Thank for your answer.BTW:jPCT is really very cool.