Processing 4.0.1 sketch window scales 200%

Hi, I’ve been using Processing for several years and recently updated to version 4.0.1. It’s fantastic except that all of a sudden every sketch window is scaled up 200% of true screen resolution! This happens on both monitors for my Windows PC (primary 3840x2160, secondary 1680x1050) and also my M1 MacBook, display 2560x1600. Never had an issue with this in the past on either one…

Turning on “Disable HiDPI Scaling” (which is only available in the Windows version) just makes the IDE half the size which is unreadable, and the sketch still renders double size. How do I fix this??

1 Like

Hi Sir and welcome

Thanks,
Looks like that thread is referring to the location of the window and not the scale. The “scale” function is used, but as far as I know that’s just a render transform. He also mentions the window is a different size, but it likely matches his monitor, whereas mine does not. For me, everything is fine except that the width and height are twice as many pixels on screen as it says in the code - for example if I set size(500, 500) and screenshot the render window, the screenshot is 1000x1000. Again, this happens on Windows and Mac after updating to 4.0.1

1 Like

Could you share a screenshot showing the problem? This sounds like it might need to be a Github issue.

1 Like

Does changing pixelDensity() do anything? https://processing.org/reference/pixelDensity_.html

1 Like

Here’s my code (indicating a target size of 480x480)

void setup(){
  size(480, 480);
}

void draw(){
  background(0);
  noStroke();
  fill(255);
  ellipse(width/2, height/2, width, height);
  fill(0);
  textAlign(CENTER, CENTER);
  textSize(100);
  text("hello\nworld!", width/2, height/2);
  textSize(20);
  text("hello\nworld!", width/2, height/2);
}

And here’s a screenshot of me taking a screenshot of the render window (showing the true resolution to be 960x960)

Good thought, but looks like not… I can change it to 2 which of course just makes the issue twice as bad, but it doesn’t seem to support 0.5 as a value.