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

Fix High DPI support #136

Open
aufau opened this issue May 8, 2020 · 1 comment
Open

Fix High DPI support #136

aufau opened this issue May 8, 2020 · 1 comment

Comments

@aufau
Copy link
Member

aufau commented May 8, 2020

In 1.4.1 High dpi support works correctly on Windows because it reports DPI as 96 * desktop scaling. It is not the case on X11, wayland and macos.

For a quick fix, revert jk2mv@a678ad2755dd155a52912b3a3c969c581e83efdb and Disable DPI console font.scaling on linux/macos.

  1. macos and wayland don't recognize jk2mv as being high dpi aware. For this special flag in SDL_CreateWindow() and a pinfo.list manifest variable on macos is required. Because of this, eg. on 4k display with desktop scaling 2x jk2mv sees native resolution as 1080p, renders at 1080p and is stretched to full screen. This means console font has correct size, although image is rendered at sub par resolution.
  2. X11 just renders jk2mv at native resolution, but DPI obtained from SDL is an actual monitor DPI, not desktop scaling. This means that with old method console font size is the same (measured physically on display) on 13 inch laptop that is usually viewed up close and on 4k tv you're watching from another end of the room. This is not correct, instead desktop scaling should be used.

SDL has a concept of "screen coordinates" for high dpi support (when conditions mentioned in 1. are met) and it seems to work on macos and wayland (wayland support is new in sdl and may be buggy). Find out if there is a better method for windows and X11 than using DPI (for reasons explained in 2.)

@aufau
Copy link
Member Author

aufau commented Jun 7, 2020

This branch: https://github.com/aufau/jk2mv/tree/wip/sdl_hidpi has code working on macos (sdl support for wayland seems broken for now, at least with opengl).
The only problem is when you launch fullscreen with non-desktop resolution. It seems to be SDL bug (wrong opengl drawing size returned by SDL?) and I'm not very motivated to work on it anymore.

Non high-dpi mode works ok. Only that you can't get high resolutions.

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

1 participant