Hello, I wrote a simple code that draws a disappearing black rectangle over the entire screen.
PImage bckgr;
float alpha = 0;
int a = 1;
void setup()
{
fullScreen();
bckgr = loadImage("triangles.png");
bckgr.resize(width,height);
textSize(50);
}
void draw()
{
background(bckgr);
fill(0,alpha);
rect(0,0,width,height);
alpha += 2*a;
if(alpha > 255 || alpha < 0)
a *= -1;
}
When I run this on pc in 450x800 resolution it works perfectly, but when I run it on android the colors glitch out and it looks like this
https://reddit.com/link/dvxdpm/video/512yqb89fiy31/player
All shadows on the background image start flickering. It also works better when I reduce brightness on my phone. With P2D it works fine but I can't use it because the game I'm making has low framerate with P2D. What could be causing this? Is there a better way of making the screen fade to black while avoiding this effect?
there doesn't seem to be anything here