Different Rendering Output when Processing is used with IntelliJ, please help

Any movement on this issue? I’m facing the same problem, getting very different output when using the Processing IDE versus another IDE (VSCode in my case).

I think the common link between me and Bufofa might be a high-density display. Mine is 3840x2160. When using the Processing IDE, I include pixelDensity(displayDensity()) and all my sketches look great. Doing the same in VSCode doesn’t work.

The first image here shows a star shape drawn in the Processing IDE at a size of 100x100 with pixelDensity set at 2. Naturally, the resulting screenshot is 200x200.

starshape100x100_processingIDE_2xpixelDensity

The second image is the same sketch created in VSCode. Taking a screenshot of the sketch using save() produces a 100x100 image, but using Print Screen shows that it is poorly scaled up to 250x250, for some reason.

starshape100x100_vscode_actualSize_cropped

My guess is that when running a Processing app in an IDE like VSCode, it cannot properly determine what sort of display it is rendering to. Calling displayDensity() in VSCode outputs 1 instead of 2. Similarly, adding pixelDensity(2) to the program prints the error “pixelDensity(2) is not available for this display.” Somehow, this results in this weird 2.5x scaling for me.

I would love some thoughts on how to fix this, or work around this. I’m building a small library for Processing in VSCode and I don’t want to have compile it and import it into the Processing IDE every time I want to test it. Beyond the output just looking ugly, I thought I was importing shapes incorrectly because the weird 2.5 scaling made all the vertices look out of place.

1 Like