I’m migrating my app from NativeActivity to SDL. When I used NativeActivity, ANativeWindow_getFormat() returned RGBX_8888 which was just fine. With SDL’s renderer, however, the surfaceChanged() callback in the Java glue code always receives RGB_565 as the pixel format which looks rather ugly because it only has 65536 colors and gradients look pretty cheap in 16 bits.
So I tried to add the following code to SDLActivity’s onCreate() before calling setContentView():
This indeed solves the problem on my Nexus 5X device running Android 8 but on my Nexus 9 tablet running Android 7 it doesn’t work and I still get 16-bit surfaces.
What is confusing me, however, is the fact that when using NativeActivity on my Nexus 9 tablet running Android 7 I actually get RGBX_8888 surfaces! So this definitely is not a hardware/system limitation on Nexus 9/Android 7. It works for NativeActivity, but not for SDL although both, SDLActivity and NativeActivity seem to be based on SurfaceView. This is rather confusing me.
So does anybody have an idea of how I could get 32-bit graphics with SDL like I can get with NativeActivity?