Skip to content
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

Resolution issue with dual monitors with different DPI #84948

Open
Jules5 opened this issue Nov 15, 2023 · 2 comments
Open

Resolution issue with dual monitors with different DPI #84948

Jules5 opened this issue Nov 15, 2023 · 2 comments

Comments

@Jules5
Copy link

Jules5 commented Nov 15, 2023

Godot version

4.1.2.stable

System information

Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1060 with Max-Q Design

Issue description

I have two screens:

  • my laptop's one, 1920x1080, 120 DPI, 125% Windows scale
  • and an external one, 1920x1080, 96 DPI, 100% Windows scale

I work on a 2D pixel perfect game. When I display it fullscreen on my laptop everything is nice and sharp, but not on the external screen where I have scaling issues (the pixel art is altered). I logged the screen resolution according to Godot and I got this:

  • laptop: 1920x1080
  • external: 2400x1350 (which is 125% of 1920x1080...)

I tried to disable the "allow_hidpi" settings, then I got this:

  • laptop: 1536x864 (125% of this gives 1920x1080...)
  • external: 1920x1080

Finally I put back the "allow_hidpi" settings and disabled the 125% scaling in windows settings:

  • laptop: 1920x1080
  • external: 1920x1080

As I understand these results I'd say that Godot is handling well the Windows scaling through the "allow_hidpi" setting, but is failign to handle correctly the case where the two screens have a different scaling value in the Windows settings. I expected Godot to use a 1920x1080 resolution for the two screens in this case.

Steps to reproduce

  • Have two screens with a same resolution
  • Give screen 1 a 125% scaling in Windows settings
  • Give screen 2 a 100% scaling in Windows settings
  • Launch any Godot scene and print "DisplayServer.screen_get_size()"
  • Move the window to a screen to another and notice the displayed value changes.

Minimal reproduction project

minimal_reproduction_project.zip

@Calinou
Copy link
Member

Calinou commented Nov 15, 2023

Godot doesn't use the Windows per-monitor DPI awareness API yet, as per #56341. This limits its ability to scale to multi-monitor setups with different scale factors.

Please upload a minimal reproduction project1 to make this easier to troubleshoot.

Which stretch mode does the project use? I suggest using 4.2.beta5 and setting the scale stretch policy in the project settings to Integer (this is a new setting in 4.2.beta). This ensures the viewport is always scaled at an integer scale.

Footnotes

  1. A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the .godot folder in the archive (but keep project.godot).

    Drag and drop a ZIP archive to upload it. Do not select another field until the project is done uploading.

    Note for C# users: If your issue is not Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available.

@Jules5
Copy link
Author

Jules5 commented Nov 17, 2023

Minimal reproduction project uploaded!

Which stretch mode does the project use?

I'm using the "canvas_item" mode.

I suggest using 4.2.beta5 and setting the scale stretch policy in the project settings to Integer (this is a new setting in 4.2.beta). This ensures the viewport is always scaled at an integer scale.

I just checked with 4.2.beta5, it's worth mentionning that with this version the issue occurs on my internal monitor (while it was on the external one with 4.1.2). Nonetheless with the integer scaling option it's better, but the viewport cover only a fraction of the display (since a wrong screen resolution is used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants