Android SDL match device resolution

How can I get the SDL surface resolution to match the actual device resolution? For example, a Pixel 6 phone has a 1080x2400 screen. When I create an SDL window using ‘SDL_WINDOW_FULLSCREEN | SDL_WINDOW_RESIZABLE’, I end up with a window size of 479x1080 (same aspect ratio, but scaled). What’s interesting is that even this value seems to depend on the ‘Display Size’ value on my phone’s settings. If I change my display size to make elements larger, then the resolution will be smaller. But even with the smallest size elements, 479x1080 is the highest resolution SDL window I can get.

Have you included SDL_WINDOW_ALLOW_HIGHDPI in the flags specified in your SDL_CreateWindow() call?

Yeah, I tried that. Best I can tell, it doesn’t seem to be hooked up to anything on Android.

I’m getting a 1080 x 2316 canvas on my One Plus 10 Pro phone (SDL 2.0.10 with SDL_WINDOW_FULLSCREEN_DESKTOP flag specified):

Thanks for checking your device.

Finally figured out the problem, I was missing a <uses-sdk android:minSdkVersion="##"/> line in my manifest file, I guess with no min SDK version the system falls back to a non-highdpi resolution.

1 Like