Image() flickers when changing sketch size with windowResize()

Hello @sableRaph,

My exploration of this:

// windowResize Flicker
// v1.0.0
// GLV 2022-09-23

//References:
// https://forum.processing.org/one/topic/flickering-when-using-the-java-frame-resize-method#25080000001705051.html
// https://github.com/processing/processing4/blob/main/build/shared/revisions.md

PImage img1;
int sz;

void setup()
  {
  windowResizable(true);
  img1 = loadImage("frog.png");
  sz = 200;
  windowResize(sz, sz);
  delay(12);
  frameRate(60);
  }
  
void draw()
  {
  println(sz, width);
  image(img1, 20, 20, sz-2*20, sz-2*20);
  sz = 200 + frameCount%200;
  windowResize(sz, sz);
  delay(12);
  }

I gleaned some insight from here:

https://forum.processing.org/one/topic/flickering-when-using-the-java-frame-resize-method#25080000001705051.html

The delay got rid of the flicker.

:)

1 Like