(iOS) 320x480 on Retina display

Hi, I hope I’m not arriving late to the party and asking a stupid or duplicated question, I did a few searches and was unable to find it.

I have updated from the 1.3 beta I was using to the latest 2.0 on the hg repository. My iOS application is trying to request a 320x480 screen resolution and I’m now finding that, instead of filling the entire screen, pixels are still 1:1 and the application lies in the lower left corner of the screen.

Am I missing something?

Any information is going to be very much appreciated, thanks! :slight_smile:

Could you paste the code you’re using to start up SDL (and glViewport,
if you’re using it)?On Sat, 25 Feb 2012 04:13:26 -0800 Manuel wrote:

Hi, I hope I’m not arriving late to the party and asking a stupid or
duplicated question, I did a few searches and was unable to find it.

I have updated from the 1.3 beta I was using to the latest 2.0 on the
hg repository. My iOS application is trying to request a 320x480
screen resolution and I’m now finding that, instead of filling the
entire screen, pixels are still 1:1 and the application lies in the
lower left corner of the screen.

Am I missing something?

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 :slight_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 640960 but since your viewport is only 320480,
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.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

Thank you very much. That, plus a SDL_SetWindowFullscreen(window, SDL_TRUE) ; call solved my problem.

Cheers :slight_smile: