pixelDensity(2) in P2D/P3D in IntelliJ doesn't work

Like I’ve posted on https://github.com/processing/processing4/issues/763 I’m having troubles launching a processing sketch outside of the IDE with a high DPI.
I’ve tried looking into the processing app’s code to see what configurations are done at launch, but no luck so far.