husker-dev / openglfx

OpenGL implementation for JavaFX
Apache License 2.0
80 stars 10 forks source link

Proper pixel scaling on macOS #66

Closed husker-dev closed 7 months ago

husker-dev commented 7 months ago

macOS has flexibility in changing monitor resolution, but it can cause some problems.

What I encountered: I have a monitor with a 3840x2160 resolution, but the system has 2304x1296 selected for correct scaling. In this case, JavaFX reports that the monitor resolution is 2304x1296, and the dpi is 2x, but the real is 1.5x. Because of this, the openglfx renders at a higher resolution and then shrink to the correct size.

It is impossible to get the actual monitor size through JavaFX (at least on macOS), so I have to use native code.

husker-dev commented 7 months ago

Complete