The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL/Android: using an invalid surface
Enno Rehling
Guest

Hi,

I've only just started experimenting with SDL on Android (usig a recent snapshot of SDL 2.0), and while it was almost easy to get something up and running, I've stumbled on an issue now that seems Android-specific: When I switch from my app to the home screen, and then go back to the app, it seems to lose the GL surface it was using before, and I see a flood of errors in the adb logcat that look like this:
E/Surface ( 3302): using an invalid surface id=1, identity=726 should be 729

I've reduced my problem to a minimal sample program and attached the logcat output here: https://gist.github.com/1967705

This all seems oddly reminiscent of the kind of problems we'd have in DirectX when switching between windowed/fullscreen mode, and I'm thinking the right solution to my problem is probably to react to SDL_WINDOWEVENT_MINIMIZED and SDL_WINDOWEVENT_RESTORED events in some way, but I don't know what the correct way to deal with these would be. Should I re-create the SDL_Renderer? My program does not have any surfaces of yet, but will I need to recreate them, too? Is there a tutorial for this that I have failed to find, and is this only a problem on Android, or will I have to deal with it on other platforms as well?

Enno.
SDL/Android: using an invalid surface
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2012/3/3 Enno Rehling
Quote:
Hi,

I've only just started experimenting with SDL on Android (usig a recent snapshot of SDL 2.0), and while it was almost easy to get something up and running, I've stumbled on an issue now that seems Android-specific: When I switch from my app to the home screen, and then go back to the app, it seems to lose the GL surface it was using before, and I see a flood of errors in the adb logcat that look like this:
E/Surface ( 3302): using an invalid surface id=1, identity=726 should be 729

I've reduced my problem to a minimal sample program and attached the logcat output here: https://gist.github.com/1967705



This is a known issue. See here http://forums.libsdl.org/viewtopic.php?t=7926 and here: http://bugzilla.libsdl.org/show_bug.cgi?id=1425 

--
Gabriel.
SDL/Android: using an invalid surface
Enno Rehling
Guest

Thanks! I actually found that forum post when I was searching for help, but I was hoping there's a known workaround for this (like, destroying all windows/renderers/surfaces and recreating them). The same problem happens when the screen orientation changes -- happens every time I touch my phone, so I've set my app to have a fixed orientation.

Enno.

On Sat, Mar 3, 2012 at 2:50 PM, Gabriel Jacobo wrote:
Quote:


2012/3/3 Enno Rehling
Quote:
Hi,

I've only just started experimenting with SDL on Android (usig a recent snapshot of SDL 2.0), and while it was almost easy to get something up and running, I've stumbled on an issue now that seems Android-specific: When I switch from my app to the home screen, and then go back to the app, it seems to lose the GL surface it was using before, and I see a flood of errors in the adb logcat that look like this:
E/Surface ( 3302): using an invalid surface id=1, identity=726 should be 729

I've reduced my problem to a minimal sample program and attached the logcat output here: https://gist.github.com/1967705




This is a known issue. See here http://forums.libsdl.org/viewtopic.php?t=7926 and here: http://bugzilla.libsdl.org/show_bug.cgi?id=1425 

--
Gabriel.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org