SDL_WINDOW_ALLOW_HIGHDPI only for OpenGl rendering?


#1

For Exult (exult.sf.net) I tried adding SDL_WINDOW_ALLOW_HIGHDPI as a flag in SDL_CreateWindow but it won’t “take” neither in OS X (I added the plist entry in the app bundle) nor on iOS.
We are using surface to render so I wonder if that’s the fault.


#2

I have the same issue with SDL2 builds of DOSBox-X today, even with the plist entry present. SDL2 appears to render at double the resolution with or without ALLOW_HIGHDPI. DOSBox-X with SDL2 is rendering to the surface of the window.

The reason for this as far as I understand Cocoa in Mac OS X is that HighDPI effectively doubles the scale of “screen” coordinates on the screen (actually, multiplied by a constant available with the NSWindow to get the backing store scale factor). To get 1:1 pixel mapping therefore, you have to give the NSWindow and NSView a width and height divided by that backing store scale, which is what I think should happen if you specify ALLOW_HIGHDPI (am I wrong?).

The heavily modified SDL1 library built into DOSBox-X’s source tree already implements a modification to enable “high DPI” and to scale down NSWindow coordinates to achieve 1:1 on Retina displays.


#3

This is with SDL2 v2.0.9 incorporated into DOSBox-X on a Mac Mini. HighDPI is forcibly enabled using SwitchResX.