Renderers (and Windows scaling)

There is a difference between `Processing 4.3 and 4.4.7 (and 4.4.10) in how the default renderer handles Windows scaling.

In Processing 4.3 a sketch with a size(200, 200) the canvas indeed 200x200 pixels; in Processing 4.4.7 it the scaling factor larger (250x250).
I have figured out that I can use the P2D renderer to prevent this (size(200,200, P2D)).

(1) Is there a reason for this (different version of Java maybe or something else).

fullScreen(P2D) in 4.4.10 however shows a rectangle in the left top corner of my screen that is 80% in each direction of what was expected (1920x1080 resolution of the laptop screen).

(2) How do I get that 1920x1080? I can obviously specify that resolution in size() but when I use a different screen I have to adjust again.

Note:
My requirements are simple; I’m not in need fancy graphics, just some rectangles and text.

1 Like

I had a Monitor on my Laptop and it helped me to say, for example

fullScreen(P3D, 0);

Which tells processing which Monitor to use I guess

Solution on my system with Windows 10 and Windows Scaling = 125% :

DPI Renderer Scaling Override for JAVA2D

This is a workaround on my system for fullscreen(P2D) :

/*
 * Fullscreen P2D Workaround
 *
 * Author:      glv
 * Date:        2025-11-09
 *
*/

static 
  {
  // Forces 1:1 pixel rendering by disabling OS-level DPI scaling
  
  System.setProperty("sun.java2d.uiScale", "1.01"); // If this is 1.0 it does NOT work!
  //System.setProperty("sun.java2d.DPIscaling", "false"); // No effect.
  }

void setup() 
  {
  //size(1920, 1200, P2D);
  
  fullScreen(P2D, 2);      // 0 is span, 1 is monitor 1, 2 is monitor 2
  println(SPAN);
  println(width, height);
  //surface.setLocation(50, 50); // Does NOT work with monitor 2 and will go to monitor 1!
  }

void draw() 
  {
  // Helps to see the size of the screen:  
  circle(50, 50,  50);
  circle(width-50, 50,  50);
  circle(width-50, height-50,  50);
  circle(50, height-50,  50); 
  circle(width/2, height/2, 50); 
  }

I came across this quite accidentally exploring this a few days ago!
It has to be at least one pixel off to work and you will see this in the println(width, height); output.

:)

Thanks people

I decided to go for FX2D (after running the code in Launcher for Multi-Renderer PApplets).

It seems to solve all problems with regards to size.

Here are some notes from my code

/*
Selecting the renderer
 1.
 Default rendering screws me around with windows scaling
 2
 P2D is OK but maximizing window takes long and circle first changes to ellipse and next to circle when maximizing
 Ignores windows scaling :+1:
 Places (in left top) without title bar :(
 Seems to have jaggered edges around cirles.
 3
 FX2D does not (easily) allow to align text (vertical align in circle)
 Needs trick to suppress windows scaling; that's acceptable
 */

I haven’t found the best way to sort the vertical text alignment out, for now subtract a fixed amount. There was a similar issue in Processing 4.2 that got solved in 4.3; see Processing 4.3 is out! ✨ - #3 by sterretje.

This leaves the first question why there is a difference between Processing 4.3 and the later versions with regards to the default renderer. I know that there is a difference in the java version (checked by running Report System and Environment Diagnostics at Runtime) but I do not know if that is the cause.

1 Like

Hello @sterretje,

You can explore issues here:

The source code for the various versions is also available to you.

I have been modifying the source code for Processing 4.4.10 to create a custom PDE and using VS Code as the editor and building on the command-line.

It is certainly an adventure!

:)