iOS Retina Display

Hello All,

I am having issues when using a Retina device in Landscape mode. I was
previously developing using a iPhone 3GS and I had no problems with the
480x320 window size. However, I recently got a new 4S and tried
developing for the larger screen size. I was under the impression that
SDL was able to handle scaling, is this not the case? Perhaps I am not
setting up SDL properly. Here is how I am currently initializing the window.

 // Initialize SDL
 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
     printf("Unable to initialize SDL: %s\n", SDL_GetError());
 }

 int screen = 0;
 int modes = SDL_GetNumDisplayModes(screen);
 for (int i = 0; i < modes; i++) {
     SDL_DisplayMode mode;
     SDL_GetDisplayMode(screen, i, &mode);
     printf("%dx%d\n", mode.w, mode.h);
 }

 // Create the SDL Window
 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
 appFacade->setWindow(SDL_CreateWindow(0, 0, 0, 

AppFacade::SCREEN_WIDTH, AppFacade::SCREEN_HEIGHT,
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE));

 SDL_SetHint("SDL_HINT_ORIENTATIONS", "LandscapeLeft LandscapeRight");

 SDL_Renderer* renderer = SDL_CreateRenderer(appFacade->getWindow(), 

-1, 0);

I am using the latest SDL 1.3 build and the most recent Xcode (4.2).

Here are two screenshots of the behavior:

http://imgur.com/R64H3,8nOtC#1

http://imgur.com/R64H3,8nOtC#0

Thanks!

Jonny

Last time I checked you need to set the window width and height to its
double dimenions (640x960) to enable retina display; the renderer will
then resize the window context to fit the size of the screen.

You could get around that by querying the video modes available and
use the biggest one to create the window.
VittorioOn Thu, Nov 24, 2011 at 8:49 AM, Jonny Morrill wrote:

Hello All,

I am having issues when using a Retina device in Landscape mode. I was
previously developing using a iPhone 3GS and I had no problems with the
480x320 window size. However, I recently got a new 4S and tried developing
for the larger screen size. I was under the impression that SDL was able to
handle scaling, is this not the case? Perhaps I am not setting up SDL
properly. Here is how I am currently initializing the window.

? ?// Initialize SDL
? ?if (SDL_Init(SDL_INIT_VIDEO) != 0) {
? ? ? ?printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
? ?}

? ?int screen = 0;
? ?int modes = SDL_GetNumDisplayModes(screen);
? ?for (int i = 0; i < modes; i++) {
? ? ? ?SDL_DisplayMode mode;
? ? ? ?SDL_GetDisplayMode(screen, i, &mode);
? ? ? ?printf("%dx%d\n", mode.w, mode.h);
? ?}

? ?// Create the SDL Window
? ?SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
? ?appFacade->setWindow(SDL_CreateWindow(0, 0, 0, AppFacade::SCREEN_WIDTH,
AppFacade::SCREEN_HEIGHT,
? ? ? ?SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE));

? ?SDL_SetHint(“SDL_HINT_ORIENTATIONS”, “LandscapeLeft LandscapeRight”);

? ?SDL_Renderer* renderer = SDL_CreateRenderer(appFacade->getWindow(), -1,
0);

I am using the latest SDL 1.3 build and the most recent Xcode (4.2).

Here are two screenshots of the behavior:

http://imgur.com/R64H3,8nOtC#1

http://imgur.com/R64H3,8nOtC#0

Thanks!

Jonny


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ok I set the window size to be 960x640 (width x height) and used my
larger tile set as well to fill the doubled size and I still see
problem. Also, it seems that It’s only present when I restrict the
device to landscape mode.

In the application summary, there’s an option for “Supported Device
Orientation”.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#0

When I select Landscape for this option I am getting the same issue with
the graphics only showing in the bottom left corner.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#1

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#2

When this option is not selected I get a full screen, however it isn’t
orientated correctly since my artwork and window is designed for a
landscape screen.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#3

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#4

I’m thinking that this has something to do with the “Supported Device
Orientation” somehow?

JONNY MORRILL
Consultant & Freelancer
ph: 925.550.2416
em: @Jonny_Morrill mailto:Jonny_Morrill
wb: jonny.morrill.me http://jonny.morrill.me
My status skype:jrmorrill?chat jrmorrill
add me on http://linkedin.com/in/jrmorrill
follow me @jrmorrill https://twitter.com/jrmorrillOn 11/24/11 12:32 AM, Vittorio Giovara wrote:

Last time I checked you need to set the window width and height to its
double dimenions (640x960) to enable retina display; the renderer will
then resize the window context to fit the size of the screen.

You could get around that by querying the video modes available and
use the biggest one to create the window.
Vittorio

On Thu, Nov 24, 2011 at 8:49 AM, Jonny Morrill<@Jonny_Morrill> wrote:

Hello All,

I am having issues when using a Retina device in Landscape mode. I was
previously developing using a iPhone 3GS and I had no problems with the
480x320 window size. However, I recently got a new 4S and tried developing
for the larger screen size. I was under the impression that SDL was able to
handle scaling, is this not the case? Perhaps I am not setting up SDL
properly. Here is how I am currently initializing the window.

// Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
    printf("Unable to initialize SDL: %s\n", SDL_GetError());
}

int screen = 0;
int modes = SDL_GetNumDisplayModes(screen);
for (int i = 0; i<  modes; i++) {
    SDL_DisplayMode mode;
    SDL_GetDisplayMode(screen, i,&mode);
    printf("%dx%d\n", mode.w, mode.h);
}

// Create the SDL Window
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
appFacade->setWindow(SDL_CreateWindow(0, 0, 0, AppFacade::SCREEN_WIDTH,

AppFacade::SCREEN_HEIGHT,
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE));

SDL_SetHint("SDL_HINT_ORIENTATIONS", "LandscapeLeft LandscapeRight");

SDL_Renderer* renderer = SDL_CreateRenderer(appFacade->getWindow(), -1,

0);

I am using the latest SDL 1.3 build and the most recent Xcode (4.2).

Here are two screenshots of the behavior:

http://imgur.com/R64H3,8nOtC#1

http://imgur.com/R64H3,8nOtC#0

Thanks!

Jonny


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I had the same issues with landscape mode and retina display before, it had
something to do with the correct display modes not being set. You might
want to step through the initialization with a debugger and see what is
happening when SDL (debug build) is selecting a display mode (in
SDL_GetClosestDisplayModeForDisplay). In an older HG, some display modes
were not properly created, so in particular pay attention to
UIKit_GetDisplayModes and SDL_AddDisplayMode, and make sure that the
relevant display modes are available.

I’m not at my mac right now, but I’ll take a look at it sometime, I’ll
eventually want landscape for my app too. There a quite a few rough corners
of SDL 1.3 that still need tweaking so you’re going to have to get your
hands dirty. Please report anything you find as it’ll help stabilize SDL
for release.

Good luck.On Fri, Nov 25, 2011 at 3:42 AM, Jonny Morrill wrote:

Ok I set the window size to be 960x640 (width x height) and used my
larger tile set as well to fill the doubled size and I still see problem.
Also, it seems that It’s only present when I restrict the device to
landscape mode.

In the application summary, there’s an option for “Supported Device
Orientation”.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#0

When I select Landscape for this option I am getting the same issue with
the graphics only showing in the bottom left corner.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#1

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#2

When this option is not selected I get a full screen, however it isn’t
orientated correctly since my artwork and window is designed for a
landscape screen.

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#3

http://imgur.com/GrVfY,adWxV,IKYHs,6W873,Uaibq#4

I’m thinking that this has something to do with the “Supported Device
Orientation” somehow?

JONNY MORRILL
Consultant & Freelancer
ph: 925.550.2416
em: jonny at morrill.me
wb: jonny.morrill.me
[image: My status] jrmorrill
add me on http://linkedin.com/in/jrmorrill
follow me @jrmorrill https://twitter.com/jrmorrill

On 11/24/11 12:32 AM, Vittorio Giovara wrote:

Last time I checked you need to set the window width and height to its
double dimenions (640x960) to enable retina display; the renderer will
then resize the window context to fit the size of the screen.

You could get around that by querying the video modes available and
use the biggest one to create the window.
Vittorio

On Thu, Nov 24, 2011 at 8:49 AM, Jonny Morrill wrote:

Hello All,

I am having issues when using a Retina device in Landscape mode. I was
previously developing using a iPhone 3GS and I had no problems with the
480x320 window size. However, I recently got a new 4S and tried developing
for the larger screen size. I was under the impression that SDL was able to
handle scaling, is this not the case? Perhaps I am not setting up SDL
properly. Here is how I am currently initializing the window.

// Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
}

int screen = 0;
int modes = SDL_GetNumDisplayModes(screen);
for (int i = 0; i < modes; i++) {
SDL_DisplayMode mode;
SDL_GetDisplayMode(screen, i, &mode);
printf("%dx%d\n", mode.w, mode.h);
}

// Create the SDL Window
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
appFacade->setWindow(SDL_CreateWindow(0, 0, 0, AppFacade::SCREEN_WIDTH,
AppFacade::SCREEN_HEIGHT,
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE));

SDL_SetHint(“SDL_HINT_ORIENTATIONS”, “LandscapeLeft LandscapeRight”);

SDL_Renderer* renderer = SDL_CreateRenderer(appFacade->getWindow(), -1,
0);

I am using the latest SDL 1.3 build and the most recent Xcode (4.2).

Here are two screenshots of the behavior:
http://imgur.com/R64H3,8nOtC#1
http://imgur.com/R64H3,8nOtC#0

Thanks!

Jonny


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I am with a similar issue… Did you fix this problem and have some useful info?

thanks

Jonny Morrill wrote:> Hello All,

I am having issues when using a Retina device in Landscape mode. I was
previously developing using a iPhone 3GS and I had no problems with the
480x320 window size. However, I recently got a new 4S and tried
developing for the larger screen size. I was under the impression that
SDL was able to handle scaling, is this not the case? Perhaps I am not
setting up SDL properly. Here is how I am currently initializing the window.

// Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
}

int screen = 0;
int modes = SDL_GetNumDisplayModes(screen);
for (int i = 0; i < modes; i++) {
SDL_DisplayMode mode;
SDL_GetDisplayMode(screen, i, &mode);
printf("%dx%d\n", mode.w, mode.h);
}

// Create the SDL Window
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
appFacade->setWindow(SDL_CreateWindow(0, 0, 0,
AppFacade::SCREEN_WIDTH, AppFacade::SCREEN_HEIGHT,
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE));

SDL_SetHint(“SDL_HINT_ORIENTATIONS”, “LandscapeLeft LandscapeRight”);

SDL_Renderer* renderer = SDL_CreateRenderer(appFacade->getWindow(),
-1, 0);

I am using the latest SDL 1.3 build and the most recent Xcode (4.2).

Here are two screenshots of the behavior:

http://imgur.com/R64H3,8nOtC#1

http://imgur.com/R64H3,8nOtC#0

Thanks!

Jonny


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org