-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scaling on HiDPI screens with Wayland #171
Conversation
The game expects getWidth and getHeight to return framebuffer coordinates rather than screen-space coordinates (as shown by the calls to glViewport). This was broken on scaling factors greater than 1 but also masked by GL_SCALE_FRAMEBUFFER. Additionally, the game's mouse code *also* expects framebuffer coordinates to be returned. This fixes that by converting to and from screen-space during calls to mouse code. Disable GLFW_COCOA_RETINA_FRAMEBUFFER for now, it seems to not play nice on non-MacOS systems. At least for me it makes the title screen larger than the window when playing in fullscreen
I think their framebuffer implementation is buggy? I don't really want to touch this since I don't have a Mac to test on I think their GPUs are weak anyways and probably can't handle rendering GTNH at 260 DPI or whatever Retina does
Decided to mark this as a draft until it can be tested on Mac/with controllers/etc I think I also need to put in a fix to properly set the window size. Right now it's setting the window size rather than the framebuffer size, I think the intended behavior is to set the framebuffer -- EDIT -- upon further inspection, it appears this behavior matches that of modern vanilla, even if not matching up perfectly with X. At worst it's a minor annoyance, so I'll leave it be. |
Tested and appears to work as normal on Mac. Definitely improved Linux experience. |
I think there might be a bug in the implementation of |
Previous implementation was broken on hidpi platforms where the size of the framebuffer and the size of the window correlate 1:1. This manifested in the mouse code thinking the mouse was in a different location than it actually was. New implementation explicitly calculates the ratio between the framebuffer size and the window size, rather than relying on glfwGetWindowContentScale. Remove GLFW_SCALE_FRAMEBUFFER/GLFW_COCOA_RETINA_FRAMEBUFFER, it appears that it is not needed.
Ready for review again |
The game expects
getWidth
andgetHeight
to return framebuffer coordinates rather than screen-space coordinates (as shown by the calls toglViewport
). This was broken on scaling factors greater than 1 but also masked byGL_SCALE_FRAMEBUFFER
.Additionally, the game's mouse code also expects framebuffer coordinates to be returned. This fixes that by converting to and from screen-space during calls to mouse code.
Disable
GLFW_COCOA_RETINA_FRAMEBUFFER
for now, it seems to not play nice on non-MacOS systems. At least for me it makes the title screen much larger than the window when playing in fullscreen.Screenshot before the change:
Screenshot after the change:
Before is marginally fuzzier (and obviously doesn't work with the title screen)