texture transparent alpha color is not working

Started by penprakash, August 14, 2013, 05:37:12 PM

Previous topic - Next topic

penprakash

Hi,

I am loading obj file which defines the transparency of the material to be alpha in the mtl file. when i loaded the background black color is still displaying. I have used following code to load the texture images. Can you please tell me, what could be the problem.

BitmapFactory.Options options = new BitmapFactory.Options();
                        options.inDither = false; //Disable Dithering mode
                        options.inPurgeable = true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared
                        options.inInputShareable = true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
                        options.inTempStorage = new byte[4 * 1024];
                        File file = new File(filePath + "/" + s);
                        fs = new FileInputStream(file);
                        bitmapFile = BitmapFactory.decodeFileDescriptor(fs.getFD(), null, options);
                        fs.close();
                        if (bitmapFile.getWidth() > 512 || bitmapFile.getHeight() > 512) {
                           texture2 = new com.threed.jpct.Texture(
                              BitmapHelper.rescale(bitmapFile, 512, 512), true);
                        }
                        else {
                           texture2 = new com.threed.jpct.Texture(
                              bitmapFile, true);
                        }
                           
                        texture2.enable4bpp(true);
                        com.threed.jpct.Texture.defaultToMipmapping(false);
                        TextureManager.getInstance().replaceTexture(s, texture2);


MTL File :
newmtl Thalaiva
   Ns 92.1600
   Ni 1.5000
   d 1.0000
   Tr 0.0000

   Tf 1.0000 1.0000 1.0000
   illum 2
   Ka 0.5098 0.5098 0.5098
   Kd 0.5098 0.5098 0.5098
   Ks 0.2500 0.2500 0.2500
   Ke 0.0000 0.0000 0.0000
   map_Ka thalaivaa.png
   map_Kd thalaivaa.png
   map_d thalaivaa_opa.png

EgonOlsen