Re: SWT GLCanvas renders incorrectly at 175% scaling and above on Windows
Posted by Alex Crossley on
URL: https://forum.jogamp.org/SWT-GLCanvas-renders-incorrectly-at-175-scaling-and-above-on-Windows-tp4043628p4043851.html
For GLCanvas, the only fix I found to fix the Windows Display Scale problem (when at 125%, 150%, 175% etc...) was to use Toolkit to get the scale and apply the factor to width & height like this:
Toolkit toolkit = Toolkit.getDefaultToolkit();
int screenDPI = toolkit.getScreenResolution();
// Standard DPI for 100% scaling is 96 DPI
double standardDPI = 96.0;
// Calculate the scaling
scale = screenDPI / standardDPI;
Then set the viewport like this:
int fbWidth = (int)(scale * width);
int fbHeight = (int)(scale * height);
gl.glViewport(0,0,fbWidth,fbHeight);
Hope this helps somebody