Author Topic: Problem texture applied on object for Samsung S3 4.1  (Read 1146 times)

Offline zerofox

  • byte
  • *
  • Posts: 15
    • View Profile
Problem texture applied on object for Samsung S3 4.1
« on: July 25, 2013, 08:36:31 am »
Hi,

I got problem on my object when i apply the texture, in Samsung S3 it looks there are some background color with not exact pattern , the texture image have alpha color. I tested on other device Samsung Galaxy Ace 2.2 and Samsung S2 4.0,  there is no problem with  this background color in texture when applied to the object. I attached the screenshots, the first one the image that got background in S3, and the second one is the actual texture image. Please help

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #1 on: July 25, 2013, 08:56:33 am »
How are you loading the texture (code snippet...)?

Offline zerofox

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #2 on: July 25, 2013, 09:05:58 am »
Hi Egon, here is the code. pretty simple code actually

texture = new Texture(bmpList.get(i),true);
texture.keepPixelData(false);
TextureManager.getInstance().addTexture("texture1", texture);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #3 on: July 25, 2013, 09:16:30 am »
How do you fill this: bmpList.get(i) ?

Offline zerofox

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #4 on: July 25, 2013, 10:22:42 am »
bmpList is an arraylist of Bitmap. It's populate the bitmaps by getting the image through the server and convert it to bitmaps also  in the app i make it scale to 256x256 in case the dimension is not supported by the texture function, could this probably the caused? But how come in Ace 2.2 and S2 they have no problem with this issue. anyway maybe my scaling function have an effect to this? i show you the code :

 public static Bitmap getScaledBitmapAndNoRotateBitmapPixel(Context ctx, Bitmap tempBmp, int width, int height){
      
 
        Bitmap resizedBitmap = Bitmap.createBitmap(Bitmap.createScaledBitmap(tempBmp, width,height, false), 0, 0,
               width, height,null, false);
       
        tempBmp.recycle();
        tempBmp=null;

    
     return resizedBitmap;
   }

Any idea what this caused? or maybe a hacks to fix this issue Thanks!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #5 on: July 25, 2013, 10:28:12 am »
Your texture actually looks that way if you ignore the alpha channel. So i think that something in your pipeline removes the alpha under some circumstances. Maybe there's a Drawable involved somewhere? In that case, you might be a victim of Android's automatic rescale and maybe that kills the alpha!?

Offline zerofox

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Problem texture applied on object for Samsung S3 4.1
« Reply #6 on: July 26, 2013, 06:33:59 am »
solved!!?!?! have been banging my head for this issue, it turns out somehow the image in the server have a different alpha that its used. So i tried to edit the image and reapply the alpha on the image again, and it works no weird background issue. So something wrong when they applied the alpha on the image  :o