Incorrect viewport size after window resizing on macOS with HDPIMode.Logical
See original GitHub issueSeems to be caused by commit a5286e70f1ee279859ee8e8cc798b8444d458aaf , specifically where:
gl20.glViewport(0, 0, width, height);
was replaced with
gl20.glViewport(0, 0, getWidth(), getHeight());
This results in the viewport size being set to logical pixels and not true pixels, which results in incorrect dimensions if display scaling is not 1. Some gl operations (viewport, scissor, etc) require true pixels in all cases.
I can reproduce this on my M1 mac (display scale of 2), the viewport renders in the bottom-left quadrant of the window. As a temporary workaround I can call Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
in my application’s resize method.
Please select the affected platforms
- Android
- iOS
- HTML/GWT
- Windows
- Linux
- macOS
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
MacOS detecting wrong screen size - Apple Community
My Macbook Pro is detecting two external monitors as completely the wrong size - in one case insanely wrong (122.5" !
Read more >Guide: Fixing External Monitor Scaling and 'Fuzziness' Issues ...
Quick guide to enable correct color mode and 125% scaling on external Dell 4K (2650 x 1440) monitors with your MacBook.
Read more >How to Resize a Window That is Too Big or Off Screen in Mac ...
The first method you should try is to click the green button in the window titlebar, this will resize the window to fit...
Read more >Web content is not rescaled when OS X moves browser ...
STR's: 1. Disconnect the external monitor by removing HDMI cable from the Macbook port. 2. Wait for the browser to appear on Macbook...
Read more >Can I prevent OS X from resizing and moving windows when ...
It's caused by the ASUS monitor shutting off after the display goes to sleep, and incorrectly signaling on the connection (to the Mac)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve tested this on my windows machine and Ubuntu VM now, seems to only affect macOS.
I believe for this issue at least there is no reason to revert all of the changes in a5286e70f1ee279859ee8e8cc798b8444d458aaf. Just changing that one line back (which was presumably done not knowing that there was a functional difference) should correct the issue.
Just tested with 1.11.1-SNAPSHOT and the issue seems to be resolved, thanks.