question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect viewport size after window resizing on macOS with HDPIMode.Logical

See original GitHub issue

Seems 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:closed
  • Created a year ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
00-Evancommented, Jun 6, 2022

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.

0reactions
00-Evancommented, Jun 19, 2022

Just tested with 1.11.1-SNAPSHOT and the issue seems to be resolved, thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found