iPhone iOS4+SDL+Multitasking cannot restore from suspend

Hi,

My code is running pretty well on iOS4. Pressing the home button my app goes into background as expected. (minimized)
But when I want to bring it back in screen (doubleclick on “home”) it comes up with a black screen. I know that its
running because I can hear the music playing. How can I restore the screen? I am using opengl.

Guess its about restoring opengles textures.

Everytime you get a window event, you’ll probably have to reload your
textures. Just listen for a SDL_WM event and automatically call a function
to reload whatever textures you are using. You can probably ignore window
movement, but resizing/iconifying will certainly need you to reload your
textures.

Take care,
-OzOn Wed, Dec 22, 2010 at 10:12 AM, akr <a.kindlbacher at gmx.de> wrote:

Hi,

My code is running pretty well on iOS4. Pressing the home button my app
goes into background as expected. (minimized)
But when I want to bring it back in screen (doubleclick on “home”) it comes
up with a black screen. I know that its
running because I can hear the music playing. How can I restore the screen?
I am using opengl.

Guess its about restoring opengles textures.


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

I get the exact behaviour of yours on jailbroken iOS 4.1 but the
screen is restored fine on a standard iOS 4.2
What version of iOS are you using and is the device jailbroken? It
might be either because of iOS < 4.2 or because it’s jailbroken (i
suspect the latter)

VittorioOn Thu, Dec 23, 2010 at 1:02 AM, Alex Barry <alex.barry at gmail.com> wrote:

Everytime you get a window event, you’ll probably have to reload your
textures.? Just listen for a SDL_WM event and automatically call a function
to reload whatever textures you are using.? You can probably ignore window
movement, but resizing/iconifying will certainly need you to reload your
textures.

Take care,
-Oz

On Wed, Dec 22, 2010 at 10:12 AM, akr <a.kindlbacher at gmx.de> wrote:

Hi,

My code is running pretty well on iOS4. Pressing the home button my app
goes into background as expected. (minimized)
But when I want to bring it back in screen (doubleclick on “home”) it
comes up with a black screen. I know that its
running because I can hear the music playing. How can I restore the
screen? I am using opengl.

Guess its about restoring opengles textures.


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

Hi there,

I ran into a similar problem a few months ago when porting a commercial, SDL and OpenGL ES enabled game to iOS. The app would run after being suspended and resumed, but the screen was black.

I found an odd fix for the problem. I’m not entirely sure why it worked either. It didn’t involve implementing texture restoration, at least not in any direct sense. What I did was modify SDL to create its window and gl context very early in the app’s lifetime: immediately after the UIApplication delegate’s applicationDidFinishLaunching method was called. When SDL’s window and gl context creation functions were invoked, it used the already-made window and gl context, rather than creating them on the fly.

– David LudwigOn Dec 22, 2010, at 10:12 AM, akr wrote:

Hi,

My code is running pretty well on iOS4. Pressing the home button my app goes into background as expected. (minimized)
But when I want to bring it back in screen (doubleclick on “home”) it comes up with a black screen. I know that its
running because I can hear the music playing. How can I restore the screen? I am using opengl.

Guess its about restoring opengles textures.


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

Thank you for this hint! Its seems to be a new feature of iOS4.2. The screen is restored when app comes back from suspend.
Works great! I only have to tell my code not to draw while being in background. Because this is not permitted and would cause a exception.

I am using 3gs, was using iOS 4.1, now 4.2, “standard” official phone from the store.

Fantastic. Thanks so much Vittorio ! This was a tough one.

andreas

Vittorio G. wrote:> I get the exact behaviour of yours on jailbroken iOS 4.1 but the

screen is restored fine on a standard iOS 4.2
What version of iOS are you using and is the device jailbroken? It
might be either because of iOS < 4.2 or because it’s jailbroken (i
suspect the latter)

Vittorio

On Thu, Dec 23, 2010 at 1:02 AM, Alex Barry <alex.barry at gmail.com> wrote:

Everytime you get a window event, you’ll probably have to reload your
textures.? Just listen for a SDL_WM event and automatically call a function
to reload whatever textures you are using.? You can probably ignore window
movement, but resizing/iconifying will certainly need you to reload your
textures.

Take care,
-Oz

On Wed, Dec 22, 2010 at 10:12 AM, akr <@akr> wrote:

Hi,

My code is running pretty well on iOS4. Pressing the home button my app
goes into background as expected. (minimized)
But when I want to bring it back in screen (doubleclick on “home”) it
comes up with a black screen. I know that its
running because I can hear the music playing. How can I restore the
screen? I am using opengl.

Guess its about restoring opengles textures.


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


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

hey guys -
are you running SDL 1.3 with iOS 4.2.1 ?
with XCode 3.2.5?

i upgraded last week and now i can’t get the SDL demos to work any longer (after clean rebuilds of everything).

anything special you had to do in order to get it to run?

thanks!!

-pete