SDL is a great library, but I’ve had some issues lately.
Recently I was using SDL to create an image software on my Mac. The logical resolution of my Mac machine is 1280X800 (also called “Point”). Then, I prepared a PNG image with a resolution of 2560X1600(in fact, that is my screenshot). Now I want to render this image to a full-screen window created by SDL. However, in fact, the picture is rendered very blurry, here I guess because although the texture with a resolution of 2560X1600, but, the logical resolution of the resolution to be processed by the render is 1280X800, which is reduced and therefore blurred. But my use of SDL_RenderSetLogicalSize
didn’t work either. What I want is that when I render PNG images, I can directly use the device’s 2560X1600 resolution pixels, not because of the logical resolution at High DPI. Can this be done?
Did you specify SDL_WINDOW_ALLOW_HIGHDPI
in your SDL_CreateWindow()
call? Also, the SDL2 docs state: “On Apple’s macOS, you must set the NSHighResolutionCapable Info.plist property to YES, otherwise you will not receive a High-DPI OpenGL canvas”.
Oh my god! You saved me. I haven’t set this value these days, and even I explicitly set SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
. I think I made a big mistake because I always thought that only by disabling this value would I be able to draw pictures pixel by pixel on a high-resolution screen. After reading your answer, I reviewed my code. And finally figured it out.
Thank you very much for your help.
In addition, I would like to add that the value NSHighResolutionCapable does not seem to need to be explicitly set, and it seems that macOS now enables high-resolution screen compatibility by default.
Thank you again for your help!