How to set the transparency of texture?

Started by kiffa, August 27, 2012, 09:35:16 AM

Previous topic - Next topic

kiffa

I used a PNG file with alpha channel as the texture of an Objcet3D, and some fragment of the Object3D were mapped to full-transparency pixel of the texture.

But when i run the app, the fragment which should be full-transparency were filled with black color.

How do i set the transparency of texture? My codes:

      in = res.openRawResource(R.raw.tex_world_trees);
      Texture t = new Texture(in, true);  // with alpha
      tm.addTexture("world_trees", t);
      in.close();
     
     obj.setTexture("world_trees");

    world.addObject(obj);
    //render、draw、display...

   

EgonOlsen

Just enable transparency for the object (Object3D.setTransparency(...)).

kiffa