[SDL] (iOS) 320x480 on Retina display
Tim Angus
tim at ngus.net
Mon Feb 27 03:09:17 PST 2012
On 25/02/2012 17:33, Manuel Montoto wrote:
> Thanks for replying. It's quite a long and obfuscated code, all of it is
> wrapped because it's contained within a big library, but this is the
> reconstruction of what you ask (verified with the debugger):
>
> flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_BORDERLESS |
> SDL_WINDOW_FULLSCREEN ;
> window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED,
> SDL_WINDOWPOS_CENTERED, 320, 480, flags) ;
>
> glViewport(0, 0, 320, 480) ;
>
> Code works OK on Windows, but I'm getting this behaviour in iOS Smile
The dimension parameters to SDL_CreateWindow on iOS are essentially
meaningless and are ignored. What is happening is that SDL is picking
the default mode of 640*960 but since your viewport is only 320*480,
you're only getting a quarter of the display.
After you create your window, you need to choose a display mode and set
it using SDL_SetWindowDisplayMode. You can discover the available
display modes by using SDL_GetNumDisplayModes and iterate them via
SDL_GetDisplayMode. Since you are explicity targetting 320*480, you will
want to select this mode specifically.
HTH.
More information about the SDL
mailing list