Open Pengiie opened 2 years ago
Thanks for reporting. Can reproduce. According to https://kynosarges.org/GuiDpiScaling.html a fix is to do the following:
java.awt.geom.AffineTransform t = canvas.getGraphicsConfiguration().getDefaultTransform();
float sx = (float) t.getScaleX(), sy = (float) t.getScaleY();
int viewportWidth = (int) (getWidth() * sx);
int viewportHeight = (int) (getHeight() * sy);
The default transform of the graphics configuration of the canvas will provide the scale factor.
We could add a corresponding e.g. getFramebufferWidth/Height()
to the GLCanvas which does this.
This bug happens with the latest snapshot, should it still happen?
Only on windows, in the same machine but linux works fine.
Thanks!! Eduardo
Sorry I was still using getWidth instead of getFramebufferWidth, it works perfect, thanks!
This is not yet deployed to maven, the latest build on maven central is from January 2021. Is it possible to do a deployment with these changes included?
edit: oh, it is deployed as snapshot.
On Windows when I create an OpenGL Canvas. If Windows Display Scaling is not 100%, if you set glViewport to the canvas's width and height, it will be incorrect.
I set the clear color to red to make it easier to see, this is when the scaling is set to 125% and the viewport is the reported canvas width and height.