www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kiffa on August 27, 2012, 09:35:16 am

Title: How to set the transparency of texture?
Post by: kiffa on August 27, 2012, 09:35:16 am
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:

Code: [Select]
      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...
   
Title: Re: How to set the transparency of texture?
Post by: EgonOlsen on August 27, 2012, 10:20:17 am
Just enable transparency for the object (Object3D.setTransparency(...)).
Title: Re: How to set the transparency of texture?
Post by: kiffa on August 27, 2012, 04:18:30 pm
Now it's ok! Thanks!