Galaxy S9+ showing colours in purple, grey and teal

I’ve just had a bug report from a user with a Galaxy S9+ saying that all the colours in my SDL game are coming out only in “purple, grey or teal”. But, he says he took a screenshot to email to me, and the screenshot comes out with normal colours!

Bit of a weird one this, and I just wondered if anyone had come across anything similar, or had any thoughts?

Could it be this one?

---------- Původní e-mail ----------

Od: SeanOConnor


Předmět: [SDL] Galaxy S9+ showing colours in purple, grey and teal

Thanks, but I don’t think so as reading through that conversation it sounds like they were setting:

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 6);

and that may have been their problem?

Also think you should set

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

Best would be to have a S9+ phone

This is a photo of a screen I’ve just been sent (it had to be a photo as taking a screenshot on the device itself weirdly gives a perfect image!). This one’s from a OnePlus 6T with Android 8.1.0. The purple colour is meant to be a light brown wood colour.

This looks like what happens when your RGB gets displayed as BGR instead. How are you setting up your pixel formats?

I use the code from Lazy Foo’s tutorial which is SDL_PIXELFORMAT_RGBA8888 so that might not be the problem?

But, I’ve just had a reply from a user though who says he’s found a workaround for this problem by setting Developer Options | Force GPU Rendering to ON on his device.

I’ve done some research on this and I do have:

<application android:hardwareAccelerated="true">

set in my app’s manifest, and I have:

minSdkVersion set to 10 and targetSDKVersion as 12, so as far as I can tell hardware acceleration should be on by default anyway and users shouldn’t need to make that settings change. I’ll have a go at upping those values to 15 and 19 (anyone know what we should have for SDL?) and see if that fixes things. I’d be interested to know what values other people use?

I have a OnePlus6 and I had the same issue with everything being tinted blue. The linked bug does fix the issue. I also use SDL_PIXELFORMAT_RGBA8888 so I decided to set my values to

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);

Although using the 565 values in the bug report also worked.

I tried your free Kozui game on play store and its all ti ted blue. If you want to apply the fix in the bug report and upload an apk somewhere I can double check it for you.

Thanks! I’ve added those SDL_GL_SetAttribute commands just before I create the window, and I’ve had a report from a user that the updated version of Kozui (1.1.2) is now working, so I’ll update all of my other games now too.

I’ve also upped the min SDK to 17 and the targetSDK to 26. Just for reference, I’m using Android Studio 3.1.4, SDL 2.0.7, SDL_image 2.0.2 compileSdkVersion 19, buildToolsVersion “27.0.3”

I’m still puzzled by why this bug occurs in the first place though, and why it only seems to affect Samsung Galaxy S9s?