Alpha transparency causing crazy rainbow glitches - Galaxy S8

Hi everyone, I’m trying to apply an alpha mask to an image in Processing for Android simply using the .mask method, e.g. img.mask(alpha) and I’m getting seriously wild glitches.

I also tried compiling the basic Alphamask example file for Android and had the same glitching (see screenshots attached).

Just wondering if this is a known issue with Processing for Android, and if there is any way around it?

My device is a Samsung Galaxy S8

This is the code of the alphamask example (straight from the Processing example file, just the size changed) which has the output in the screenshot when run on my android device.

PImage img;
PImage maskImg;

void setup() {
  size(800, 800);
  img = loadImage("test.jpg");
  maskImg = loadImage("mask.jpg");
  img.resize(height/2,0);
  maskImg.resize(height/2,0);
  img.mask(maskImg);
  imageMode(CENTER);
}

void draw() {
  background(map(mouseX+mouseY, 0, width+height, 0, 255));
  image(img, width/2, height/2);
  image(img, mouseX, mouseY);
}

Thanks

Try using the P2D renderer and let us know if that fixes the issue:

fullScreen(P2D);

Kf

1 Like

I confirm the solution is to use the P2D renderer. I could not find a prev reported issue so I created one for you here.

Kf

1 Like

thanks so much, your solution worked! :smiley: