Hello @humano ,
Good topic! And not always a simple answer. I hope some of the points raised helped. I have often dealt with these myself and was able to sort them out in the end or work around them.
Processing will automatically relocate the size() function to settings() behind the scenes when the sketch is executed.
The choice of renderer can affect the sketch’s appearance and how it responds to Windows scaling settings in my experience.
Simple static mode sketch used to generate images below:
//size(300, 300); // Same as size(300, 300, JAVA2D);
size(300, 300, P2D);
background(255);
strokeWeight(5);
// smooth(); // See reference for usage
*strong text*
for (int i = 0; i < width; i = i+20)
{
line(i, 0, i+100, height);
}
W10 Processing 4.4.4 JAVA2D (default) renderer:
W10 Processing 4.4.4 P2D renderer:
I used windows magnifier to zoom in to see the differences.
The above were with 100% scaling.
Below I used:
If I use 125% scaling on my Windows PC it scales up (Windows scaling) the output window for JAVA2D:
There is no change to the P2D output at 125% scaling:
Sketches can be static mode or active mode.
There is documentation for this here:
Environment / Processing.org < See Programming Styles
If you want to run a sketch once you have some choices:
- Static mode
- Active mode with code in setup() and only use setup() without draw()
- Active mode and code in draw() and use noLoop() to run it only once. You may want to animate later.
And here is an interesting output (triangle of wider lines) with Windows scaling of 125% for straight lines with JAVA2D :
void setup()
{
size(300, 300, JAVA2D);
strokeWeight(5);
}
void draw()
{
background(255);
for (int i = 0; i < width; i = i+20)
{
line(i, 0, i, height);
}
}
Output (easier to see if you scroll it up and down quickly):
And an important point often overlooked:
And you are using Open Processing to complicate the matter with its own issues:
Have fun!
:)





