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
Changing video mode/driver on Android?
NY00123
Guest

** Note: I'm sending this again to the mailing list, as I haven't seen my message on the forums. Rather than any mailing list and forums syncing issue, I think it is my fault in a way.
I have also updated the attached source file: Although irrelevant in this very specific case, there is no need for any call to SDL_UpdateTexture here.
Apologizes for any inconvenience.

* Original post textual contents *

Hi all,

I would like to ask if there is a way of changing video driver within an SDL 2.0 Android app without restarting the app, as done by many games on desktop environments. If it's impossible, is that a known limitation of the Android platform?

To avoid further confusions, I refer to one of a few ways to display graphics: Using OpenGL directly (at least on desktops), some implementation of an SDL_Renderer (like OpenGL ES 1.0 and Software) or an SDL_Surface returned by SDL_GetWindowSurface.

For reference, I have attached a minor test app, along with an Android.mk file that should reside in the exact same location (android-project-path/jni/src).
Android.mk is taken right off a modification of the SDL 2.0 Android project template (about 1 month old), and the app has been tested using a recent revision of SDL itself. I have used "ndk-build" and "ant" for the construction of an Android package.

A GNU/Linux desktop executable can also be constructed (at least on Ubuntu 12.04, x86_64), using a command like this:

gcc sample.c -o sample `sdl2-config --cflags --libs`

The various calls of the form "SDL_Delay(1000);" exist for simplistic debugging purposes. I've just had some troubles with ndk-gdb and the delay commands help at the moment. So far it looks like the app crashes for me on an Android device as it attempts to create a renderer for the second time. I have also attempted to use the exact same window, but with different renderers (so only the first renderer is destroyed, not the window); It has similarly failed.

Maybe I should accept that a manual app restart is required?

To finish, if someone spots a bug in the attached source file by chance, please inform if you can.

Thanks,
NY