Initial landscape mode on iOS not working

Hi,

When I start my app with initial interface orientation as Landscape
(right home button)
and with SDL_SetVideoMode(1024,768,…), I was expecting things to work.
(That is,
my app should come up in landscape mode.) And it has been working for me.
(See my email and bug report from a few months ago, about
SDL_GetDisplayMode on
iPad.)

However, it now seems to come up in portrait as if the device is in
768x1024 (WxH) mode.

Does anybody have a suggestion what I can check? Or has something changed
in this area?–
Kees

Don’t know about ios, but for android you can force a given screen
orientation in the manifest .xml: essentially the app global properties.
Mabye iphone has something similar?

William

Hi,

When I start my app with initial interface orientation as Landscape
(right home button)
and with SDL_SetVideoMode(1024,768,…), I was expecting things to work.
(That is,
my app should come up in landscape mode.) And it has been working for
me.On 8 Aug 2011 07:32, “Kees Bakker” <kees.bakker at xs4all.nl> wrote:
(See my email and bug report from a few months ago, about
SDL_GetDisplayMode on
iPad.)

However, it now seems to come up in portrait as if the device is in
768x1024 (WxH) mode.

Does anybody have a suggestion what I can check? Or has something changed
in this area?

Kees


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

It does, in Info.plist.

We were screwing around with this a few months ago, though: it should
try to choose portrait or landscape for you depending on if you
specified 1024x768 or 768x1024.

If this isn’t working, though, please let me know.

–ryan.On 08/07/2011 04:59 PM, William Dyce wrote:

Don’t know about ios, but for android you can force a given screen
orientation in the manifest .xml: essentially the app global properties.
Mabye iphone has something similar?

Kees Bakker wrote:

However, it now seems to come up in portrait as if the device is in
768x1024 (WxH) mode.

When in a full screen openGL mode, you are getting a 768x1024 screen,
and most manually adjust your view (basically rotating it 90 degrees and
setting some offsets.)

It’s a bit obnoxious. SDL 1.3 still reports 768x1024 (as it should, as
it’s what the OS reports.) You also have to flip a couple coordinates.
Luckily, it’s usually only in one place, use projection/model view code.*

I’d also recommend leaving behind the SDL 1.2 layer and going with the
SDL 1.3 layer.

  • unless all this changed somewhere and nobody told me.
  • it’s the way I do it. :slight_smile:
  • if you aren’t doing an OpenGL layer but some sprite layer, this might
    not apply, I don’t know anything about that.

[>] Brian

Op 2011-08-08 15:21 , Brian Barnes schreef:

Kees Bakker wrote:

However, it now seems to come up in portrait as if the device is in
768x1024 (WxH) mode.

Hi Brian,

When in a full screen openGL mode, you are getting a 768x1024 screen,
Yes, that’s what I think too. However, SDL tells me that I have a 1024x768
screen.
and most manually adjust your view (basically rotating it 90 degrees
and setting some offsets.)
Yep, that is what I’m doing. (( BTW. It’s in TuxCap code. ))

It’s a bit obnoxious. SDL 1.3 still reports 768x1024
No it does not. At least not in my case. It reports 1024x768. But what
do you mean by “it reports…”? What SDL call are you talking about?
(as it should, as it’s what the OS reports.)
Yep
You also have to flip a couple coordinates. Luckily, it’s usually
only in one place, use projection/model view code.*
I have the code in place, and it’s working as expected.

I’d also recommend leaving behind the SDL 1.2 layer and going with the
SDL 1.3 layer.
Yes, I’m already in the process to do that. But the SDL1.3 (latest hg)
gives me the same
result. If only SDL would give me 768x1024 …–
Kees

Op 2011-08-08 15:21 , Brian Barnes schreef:

SDL 1.3 still reports 768x1024

Which SDL function should I use for this? I noticed these two
functions (both give me the result I want):

SDL_GetCurrentDisplayMode
SDL_GetDesktopDisplayMode-- 

Kees

Kees Bakker wrote:

It’s a bit obnoxious. SDL 1.3 still reports 768x1024
No it does not. At least not in my case. It reports 1024x768. But what
do you mean by “it reports…”? What SDL call are you talking about?
(as it should, as it’s what the OS reports.)
Yep

This is probably a 1.2 thing. In 1.3, calling SDL_GetDesktopDisplayMode(…) returns the correct cordinates.

I’d also recommend leaving behind the SDL 1.2 layer and going with the
SDL 1.3 layer.
Yes, I’m already in the process to do that. But the SDL1.3 (latest hg)
gives me the same
result. If only SDL would give me 768x1024 …

Weird. So, forget what I said above :slight_smile: For me it returns the width as 768 and the height as 1024. This might be something else.

[>] Brian

Mabye this is a 1.3->1.2 compat mode problem. Are you using a surface or a
window? You can define SDL_NO_COMPAT make sure you have no legacy functions
lying around.

Just a thought.

WilliamOn 9 Aug 2011 07:17, “Brian Barnes” wrote:

Op 2011-08-08 23:16 , Brian Barnes schreef:

Kees Bakker wrote:

It’s a bit obnoxious. SDL 1.3 still reports 768x1024
No it does not. At least not in my case. It reports 1024x768. But what
do you mean by “it reports…”? What SDL call are you talking about?
(as it should, as it’s what the OS reports.)
Yep

This is probably a 1.2 thing. In 1.3, calling SDL_GetDesktopDisplayMode(…) returns the correct cordinates.

OK thanks. SDL_GetDesktopDisplayMode gives me what I want.
(( I was using the first mode from SDL_GetDisplayMode, that’s
what was wrong. ))
I’ll have to check how this behaves on MacOS and Linux.
There is not much doc for this function. Let’s hope that this is
what I need.–
Kees

Op 2011-08-08 23:26 , William Dyce schreef:

Mabye this is a 1.3->1.2 compat mode problem. Are you using a surface
or a window? You can define SDL_NO_COMPAT make sure you have no legacy
functions lying around.

Just a thought.

Ah thanks. I like that.–
Kees

Let me know what the problem was when you solve it. Before long I may be
directly involved with iOS myself.

WilliamOn 10 Aug 2011 05:37, “Kees Bakker” <kees.bakker at xs4all.nl> wrote:

Op 2011-08-08 23:26 , William Dyce schreef:

Mabye this is a 1.3->1.2 compat mode problem. Are you using a surface
or a window? You can define SDL_NO_COMPAT make sure you have no legacy
functions lying around.

Just a thought.

Ah thanks. I like that.

Kees


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

Hi William,

SDL_GetDesktopDisplayMode is the function that gives the desired 768x1024

I was simply using SDL_GetDisplayMode(0, 0…) assuming the first from the
list was the default mode. But under hood SDL collects all available display
modes per display, and then does a SDL_sort on the list. This resulted that
1024x768 came out on top.

I am now going to weed out the compat stuff…
– Kees

Op 2011-08-10 02:28 , William Dyce schreef:>

Let me know what the problem was when you solve it. Before long I may
be directly involved with iOS myself.

William

On 10 Aug 2011 05:37, “Kees Bakker” <@Kees_Bakker mailto:Kees_Bakker> wrote:

Op 2011-08-08 23:26 , William Dyce schreef:

Mabye this is a 1.3->1.2 compat mode problem. Are you using a surface
or a window? You can define SDL_NO_COMPAT make sure you have no legacy
functions lying around.

Just a thought.

Ah thanks. I like that.

Kees


SDL mailing list
SDL at lists.libsdl.org <mailto: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’m using SDL_CreateWindow rather than SDL_SetVideoMode to open the
window, and SDL_GetWindowSize to work out what resolution I’ve been
allocated by the device. I’m not sure about iOS, but I know I was having a
lot of compatibility-related problems that were solved by going full-on SDL
1.3.

WilliamOn 11 August 2011 05:52, Kees Bakker <kees.bakker at xs4all.nl> wrote:

Hi William,

SDL_GetDesktopDisplayMode is the function that gives the desired 768x1024

I was simply using SDL_GetDisplayMode(0, 0…) assuming the first from the
list was the default mode. But under hood SDL collects all available
display
modes per display, and then does a SDL_sort on the list. This resulted that
1024x768 came out on top.

I am now going to weed out the compat stuff…
– Kees

Op 2011-08-10 02:28 , William Dyce schreef:

Let me know what the problem was when you solve it. Before long I may be
directly involved with iOS myself.

William

On 10 Aug 2011 05:37, “Kees Bakker” <kees.bakker at xs4all.nl <mailto: kees.bakker at xs4all.nl>**> wrote:

Op 2011-08-08 23:26 , William Dyce schreef:

Mabye this is a 1.3->1.2 compat mode problem. Are you using a surface
or a window? You can define SDL_NO_COMPAT make sure you have no legacy
functions lying around.

Just a thought.

Ah thanks. I like that.

Kees

_____________**
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>

http://lists.libsdl.org/**listinfo.cgi/sdl-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.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.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi William,

Well, I am using SDL_CreateWindow. But that function needs a width and
height.
At first I was simply using SDL_GetDisplayMode to get the width and
height. But now I’m
using SDL_GetDesktopDisplayMode. On the iOS device it works out OK. I
haven’t
tested any other environment yet (MacOS, Linux, etc).

– Kees

Op 2011-08-12 05:15 , William Dyce schreef:> I’m using SDL_CreateWindow rather than SDL_SetVideoMode to open

the window, and SDL_GetWindowSize to work out what resolution I’ve
been allocated by the device. I’m not sure about iOS, but I know I was
having a lot of compatibility-related problems that were solved by
going full-on SDL 1.3.

William

I see…
On Android this chosen resolution is actually overridden by the device so
you can put (0,0). Guess the same is not true of iPhone, and if you’re
compiling with no_compat I’m really not sure what the problem is :-\

WilliamOn 17 Aug 2011 07:27, “Kees Bakker” <kees.bakker at xs4all.nl> wrote:

On Android this chosen resolution is actually overridden by the device
so you can put (0,0).

Fwiw, I consider that a bug, but it’s good enough for now.

The iPad (and maybe the iPhone?) can simultaneously drive an external
display through an adapter that plugs into its port, so that definitely
needs the ability to query and specify specific resolutions.

…not to mention that different iOS devices have different main screen
resolutions, too.

I would hope we match this on Android, too.

–ryan.

Didn’t know that Ryan. Still, makes it easy for me to grab the max
resolution of the device and compare it to the “canonical” resolution (used
for desktops) in order to scale all the images up or down. If you do "fix"
this problem, please leave the option of doing things the broken way ;)On 17 August 2011 11:02, Ryan C. Gordon wrote:

On Android this chosen resolution is actually overridden by the device

so you can put (0,0).

Fwiw, I consider that a bug, but it’s good enough for now.

The iPad (and maybe the iPhone?) can simultaneously drive an external
display through an adapter that plugs into its port, so that definitely
needs the ability to query and specify specific resolutions.

…not to mention that different iOS devices have different main screen
resolutions, too.

I would hope we match this on Android, too.

–ryan.

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