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

Blurry SDL2 rendering on macOS with Retina displays (with fix) #233

Open
conker-rsc opened this issue Nov 10, 2024 · 0 comments
Open

Blurry SDL2 rendering on macOS with Retina displays (with fix) #233

conker-rsc opened this issue Nov 10, 2024 · 0 comments

Comments

@conker-rsc
Copy link
Contributor

conker-rsc commented Nov 10, 2024

I noticed this when running a self-compiled binary of rsc-c on my m1 macos air laptop: when using SDL2 as the renderer, the overall image displays rather blurry. I was able to track down the root cause, which can be attributed to using a Retina display.

I found an article which describes a fix, located here: https://www.studyplan.dev/sdl-dev/sdl-setup-mac/q/sdl2-macos-retina-display

I tried this out myself, by setting the following flag within mudclient-sdl2.c:

SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "0");

and adding the second mask to the following line:

uint32_t windowflags = SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI;

Doing so does result in correcting the issue, which may be seen in the following annotated screenshots:

Screenshot 2024-11-10 at 12 55 43 PM

Unfortunately I don't have enough time to create a proper PR at the moment, which I imagine would only apply these changes if the process is running on macOS with a retina display (as to avoid possible unintended side-effects with things like non-retina displays or native Windows OS scaling). As such, I wanted to at least document this issue and my findings here.

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

No branches or pull requests

1 participant