SDL_GetDisplayMode on iPad gives 1024x768 instead of 768x1024

Hi,

Maybe I’m getting this wrong but I am expecting to see 768x1024
when I initially do SDL_GetDisplayMode() on my iPad.

The simulator correctly gives 768x1024, but on the iPad I see
1024x768.

The Apple doc says: “All iOS applications launch in portrait mode
initially…”.

BTW. At the moment my program totally ignores all iOS gravity
events, or whatever it is called. The program believes it is just
on a regular desktop environment.

Does other people see this too?

– Kees

Hi,

Maybe I’m getting this wrong but I am expecting to see 768x1024
when I initially do SDL_GetDisplayMode() on my iPad.

The simulator correctly gives 768x1024, but on the iPad I see
1024x768.

The Apple doc says: “All iOS applications launch in portrait mode
initially…”.

Debugging a little further using the test program in the Xcode template…

This is what I see.

SDL_DisplayMode mode;
SDL_GetDisplayMode(0, 0, &mode);
int width = mode.w;
int height = mode.h;
printf("width/height = %dx%d\n", width, height);

This prints:
width/height = 1024x768

Then stepping into SDL_CreateWindow with my width and height.
It does this:
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
window->magic = &_this->window_magic;
window->id = _this->next_object_id++;
window->x = x;
window->y = y;
window->w = w;
window->h = h;

But then in UIKit_CreateWindow and further down in SetupWindowData
it does this:

/* Fill in the SDL window with the window data */
{
    window->x = 0;
    window->y = 0;
    window->w = (int)uiwindow.frame.size.width;
    window->h = (int)uiwindow.frame.size.height;
}

After that width/height is now 768 x 1024.

With the new setting I don’t have a problem. It’s the SDL_GetDisplayMode
that I don’t like. Wouldn’t you agree?

– KeesOn 15 Feb, 2011, at 22:25 , Kees Bakker wrote:

Hi,

Maybe I’m getting this wrong but I am expecting to see 768x1024
when I initially do SDL_GetDisplayMode() on my iPad.

The simulator correctly gives 768x1024, but on the iPad I see
1024x768.

The Apple doc says: “All iOS applications launch in portrait mode
initially…”.

Debugging a little further using the test program in the Xcode template…

It is only now that I see this in SDL_uikitvideo.m. I’m still studying
what it means :slight_smile:

/*
!!! FIXME:

The main screen should list a AxB mode for portrait orientation, and then
also list BxA for landscape mode. When setting a given resolution, we should
rotate the view’s transform appropriately (extra credit if you check the
accelerometer and rotate the display so it’s never upside down).

http://iphonedevelopment.blogspot.com/2008/10/starting-in-landscape-mode-without.html

*/On 16 Feb, 2011, at 21:48 , Kees Bakker wrote:

On 15 Feb, 2011, at 22:25 , Kees Bakker wrote:

Hi,

Maybe I’m getting this wrong but I am expecting to see 768x1024
when I initially do SDL_GetDisplayMode() on my iPad.

The simulator correctly gives 768x1024, but on the iPad I see
1024x768.

The Apple doc says: “All iOS applications launch in portrait mode
initially…”.

Debugging a little further using the test program in the Xcode template…

It is only now that I see this in SDL_uikitvideo.m. I’m still studying
what it means :slight_smile:

/*
!!! FIXME:

The main screen should list a AxB mode for portrait orientation, and then
also list BxA for landscape mode. When setting a given resolution, we should
rotate the view’s transform appropriately (extra credit if you check the
accelerometer and rotate the display so it’s never upside down).

http://iphonedevelopment.blogspot.com/2008/10/starting-in-landscape-mode-without.html

*/

For the time being I have disabled SDL_UIKit_supports_multiple_displays. It will
then use [uiscreen bounds] which gives the correct 768x1024 for me.

diff -r 48067bfc300c src/video/uikit/SDL_uikitvideo.m
— a/src/video/uikit/SDL_uikitvideo.m Mon Feb 14 11:50:18 2011 -0600
+++ b/src/video/uikit/SDL_uikitvideo.m Wed Feb 16 23:58:23 2011 +0100
@@ -184,8 +184,10 @@

 NSString *reqSysVer = @"3.2";
 NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

+#if 0
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES;
+#endif

 // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
 //  The iPad added both a larger main screen and the ability to use

– KeesOn 16 Feb, 2011, at 22:09 , Kees Bakker wrote:

On 16 Feb, 2011, at 21:48 , Kees Bakker wrote:

On 15 Feb, 2011, at 22:25 , Kees Bakker wrote:

Great. Can you also add a bug to bugzilla so we can track and fix this?
http://bugzilla.libsdl.org/

Thanks!On Wed, Feb 16, 2011 at 3:02 PM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

On 16 Feb, 2011, at 22:09 , Kees Bakker wrote:

On 16 Feb, 2011, at 21:48 , Kees Bakker wrote:

On 15 Feb, 2011, at 22:25 , Kees Bakker wrote:

Hi,

Maybe I’m getting this wrong but I am expecting to see 768x1024
when I initially do SDL_GetDisplayMode() on my iPad.

The simulator correctly gives 768x1024, but on the iPad I see
1024x768.

The Apple doc says: “All iOS applications launch in portrait mode
initially…”.

Debugging a little further using the test program in the Xcode
template…

It is only now that I see this in SDL_uikitvideo.m. I’m still studying
what it means :slight_smile:

/*
!!! FIXME:

The main screen should list a AxB mode for portrait orientation, and then
also list BxA for landscape mode. When setting a given resolution, we
should
rotate the view’s transform appropriately (extra credit if you check the
accelerometer and rotate the display so it’s never upside down).

http://iphonedevelopment.blogspot.com/2008/10/starting-in-landscape-mode-without.html

*/

For the time being I have disabled SDL_UIKit_supports_multiple_displays. It
will
then use [uiscreen bounds] which gives the correct 768x1024 for me.

diff -r 48067bfc300c src/video/uikit/SDL_uikitvideo.m
— a/src/video/uikit/SDL_uikitvideo.m Mon Feb 14 11:50:18 2011 -0600
+++ b/src/video/uikit/SDL_uikitvideo.m Wed Feb 16 23:58:23 2011 +0100
@@ -184,8 +184,10 @@

NSString *reqSysVer = @"3.2";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

+#if 0
if ([currSysVer compare:reqSysVer options:NSNumericSearch] !=
NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES;
+#endif

// If this is iPhoneOS < 3.2, all devices are one screen, 320x480

pixels.
// The iPad added both a larger main screen and the ability to use

– Kees


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


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

Great. Can you also add a bug to bugzilla so we can track and fix this?
http://bugzilla.libsdl.org/

I did.

For the time being I have disabled SDL_UIKit_supports_multiple_displays. It will
then use [uiscreen bounds] which gives the correct 768x1024 for me.

diff -r 48067bfc300c src/video/uikit/SDL_uikitvideo.m
— a/src/video/uikit/SDL_uikitvideo.m Mon Feb 14 11:50:18 2011 -0600
+++ b/src/video/uikit/SDL_uikitvideo.m Wed Feb 16 23:58:23 2011 +0100
@@ -184,8 +184,10 @@

NSString *reqSysVer = @"3.2";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

+#if 0
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES;
+#endif

// If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
//  The iPad added both a larger main screen and the ability to use

BTW. This “fix” causes a black screen in the simulator. Nothing comes for
free, is it?

– KeesOn 17 Feb, 2011, at 24:30 , Sam Lantinga wrote: