10

I have been playing around with SDL 2.0 but after searching I haven't found anything online about how to support retina macs. When creating a window using the following code.

gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED,
          SDL_WINDOWPOS_UNDEFINED, 500, 500, SDL_WINDOW_SHOWN);

It creates a window that has an actual size of 1000 * 1000. This isn't really an issue because it's how apps are supposed to work using a hidpi screen. However, when loading images I can't seem to find a way to load images that are 2x as big for retina screens and my images always look blurry.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Eamonn
  • 187
  • 2
  • 13

2 Answers2

18

Current versions of SDL2 have support for retina.

To create a retina window, pass a flag SDL_WINDOW_ALLOW_HIGHDPI into SDL_CreateWindow().

After a resize event, you can check the actual buffer resolution with the API call SDL_GL_GetDrawableSize().

Bram
  • 7,440
  • 3
  • 52
  • 94
0

Right now, SDL doesn't support retina displays on Macs (or High-DPI displays on Windows machines).

There is discussion about how best to add these features, and a few prototype patches on SDL's bug tracker, here: https://bugzilla.libsdl.org/show_bug.cgi?id=1934

Presumably we'll see official retina support in a future release of SDL2. Or if you're willing to compile your own SDL libraries, those patches work for me.

Trevor Powell
  • 1,154
  • 9
  • 20