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
Android device displays everything in purple tones
Limanima


Joined: 09 Oct 2013
Posts: 75
Today a friend of mine installed my game on his device and something is wrong. All the game is tinted in purple tones. At the beggining I thought there was some color channel switching, but there's a strange behaviour:
A screen capture shows the colors correctly. When the game is minimizing, the colors are ok. The colors are also good in the android task manager. The colors are only wrong when the game is active.
This behaviour makes think that: the color information and the texture format are correct and the shaders are ok (and are very simple).
As anyone ever experienced something similar?
Android device displays everything in purple tones
Reto Schneider
Guest

On 26.02.2015 18:22, Limanima wrote:
Quote:
As anyone ever experienced something similar?

Yes: https://bugzilla.libsdl.org/show_bug.cgi?id=2291

And it is not yet resolved.

Regards,
Reto
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Android device displays everything in purple tones
Limanima


Joined: 09 Oct 2013
Posts: 75
Reto Schneider wrote:
On 26.02.2015 18:22, Limanima wrote:
Quote:
As anyone ever experienced something similar?

Yes: https://bugzilla.libsdl.org/show_bug.cgi?id=2291

And it is not yet resolved.

Regards,
Reto


Ok thanks. At least I have some clues of what is going on.
SiPlus


Joined: 06 Feb 2015
Posts: 13
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).
Limanima


Joined: 09 Oct 2013
Posts: 75
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.
SiPlus


Joined: 06 Feb 2015
Posts: 13
Limanima wrote:
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.

Actually yes, I just tried, __ANDROID__ is set to 1.
Limanima


Joined: 09 Oct 2013
Posts: 75
SiPlus wrote:
Limanima wrote:
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.

Actually yes, I just tried, __ANDROID__ is set to 1.


Sorry, I've checked the code and you may actually be right. I'm going to try that. Maybe this should be fixed in the head?
Limanima


Joined: 09 Oct 2013
Posts: 75
SiPlus wrote:
Limanima wrote:
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.

Actually yes, I just tried, __ANDROID__ is set to 1.


I forced a compile error in the piece of code and the compiler reports the error. That code is compiling in Android. That's not the problem after all.
Limanima


Joined: 09 Oct 2013
Posts: 75
Limanima wrote:
SiPlus wrote:
Limanima wrote:
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.

Actually yes, I just tried, __ANDROID__ is set to 1.


I forced a compile error in the piece of code and the compiler reports the error. That code is compiling in Android. That's not the problem after all.


I did this (like Hak Matsuda suggested in the bugzilla entry):

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

After creating the rendering and it solved the problem on the faulting device. It doesn't seem to have broken the other devices.
Limanima


Joined: 09 Oct 2013
Posts: 75
Limanima wrote:
Limanima wrote:
SiPlus wrote:
Limanima wrote:
SiPlus wrote:
IT'S NOT PURPLE, IT'S WHITE AND GOLD!!! Very Happy

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).


I don't think that will solve the problem. It's seems to be a render target problem.

Actually yes, I just tried, __ANDROID__ is set to 1.


I forced a compile error in the piece of code and the compiler reports the error. That code is compiling in Android. That's not the problem after all.


I did this (like Hak Matsuda suggested in the bugzilla entry):

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

After creating the rendering and it solved the problem on the faulting device. It doesn't seem to have broken the other devices.


Correction to the previous post: it's not AFTER, it's BEFORE creating the renderer.
Android device displays everything in purple tones
slvn


Joined: 06 Oct 2012
Posts: 88
From what I remember, setting 565 is a workaround, because it will choose indirectly a different "egl-configuration".



But that's the best thing to do currently.




I spend some time to help in this ticket and the problem as I understandood it, is: 
- the device S3 provides many egl-configurations.
- the application is in landscape and choose/request an egl-configuration.


At first, the selected "egl-config" seems correct (regarding colors, depth, etc.), but, in fact,when running, the application appears to be bad (red screen problem).





Can you tell if you hardware device is a S3 ? and if you application is also landscape ?




Another issue that happens to me is this one: https://bugzilla.libsdl.org/show_bug.cgi?id=2774


The application is landscape. The java layer calls incorrectly "onSurfaceChanged()" with (width, height) instead of (height, width).
Then the screen is distorded.
But it is only problematic with some egl-configurations and some device.


You may want to try the path attached in this ticket. Please, tell if you try it and the result !







On Tue, Mar 3, 2015 at 1:00 PM, Limanima wrote:
Quote:



Limanima wrote:




Limanima wrote:




SiPlus wrote:




Limanima wrote:




SiPlus wrote:

IT'S NOT PURPLE, IT'S WHITE AND GOLD!!!

Anyway, try changing #if __ANDROID__ to #ifdef __ANDROID__ in src/video/SDL_egl.c. It's possible that the NDK simply defines __ANDROID__ instead of setting it to 1 (I'm not exactly sure about this, but another macro, ANDROID, is defined by NDK-Build with -DANDROID, not -DANDROID=1).




I don't think that will solve the problem. It's seems to be a render target problem.



Actually yes, I just tried, __ANDROID__ is set to 1.




I forced a compile error in the piece of code and the compiler reports the error. That code is compiling in Android. That's not the problem after all.




I did this (like Hak Matsuda suggested in the bugzilla entry):

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

After creating the rendering and it solved the problem on the faulting device. It doesn't seem to have broken the other devices.




Correction to the previous post: it's not AFTER, it's BEFORE creating the renderer.


_______________________________________________
SDL mailing list

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





--
Sylvain Becker
Re: Android device displays everything in purple tones
Limanima


Joined: 09 Oct 2013
Posts: 75
slvn wrote:
From what I remember, setting 565 is a workaround, because it will choose indirectly a different "egl-configuration".

But that's the best thing to do currently.

I spend some time to help in this ticket and the problem as I understandood it, is: 
- the device S3 provides many egl-configurations.
- the application is in landscape and choose/request an egl-configuration.

At first, the selected "egl-config" seems correct (regarding colors, depth, etc.), but, in fact,when running, the application appears to be bad (red screen problem).

Can you tell if you hardware device is a S3 ? and if you application is also landscape ?

Another issue that happens to me is this one: https://bugzilla.libsdl.org/show_bug.cgi?id=2774

The application is landscape. The java layer calls incorrectly "onSurfaceChanged()" with (width, height) instead of (height, width).
Then the screen is distorded.
But it is only problematic with some egl-configurations and some device.


You may want to try the path attached in this ticket. Please, tell if you try it and the result !
Sylvain Becker


It is an S3 but my application is in portait not in landscape (not my phone).

I've never experienced the distorted issue in my phone (Galaxy Fresh) nor the red screen problem.
Re: Android device displays everything in purple tones
Limanima


Joined: 09 Oct 2013
Posts: 75
Limanima wrote:
slvn wrote:
From what I remember, setting 565 is a workaround, because it will choose indirectly a different "egl-configuration".

But that's the best thing to do currently.

I spend some time to help in this ticket and the problem as I understandood it, is: 
- the device S3 provides many egl-configurations.
- the application is in landscape and choose/request an egl-configuration.

At first, the selected "egl-config" seems correct (regarding colors, depth, etc.), but, in fact,when running, the application appears to be bad (red screen problem).

Can you tell if you hardware device is a S3 ? and if you application is also landscape ?

Another issue that happens to me is this one: https://bugzilla.libsdl.org/show_bug.cgi?id=2774

The application is landscape. The java layer calls incorrectly "onSurfaceChanged()" with (width, height) instead of (height, width).
Then the screen is distorded.
But it is only problematic with some egl-configurations and some device.


You may want to try the path attached in this ticket. Please, tell if you try it and the result !
Sylvain Becker


It is an S3 but my application is in portait not in landscape (not my phone).

I've never experienced the distorted issue in my phone (Galaxy Fresh) nor the red screen problem.


I also confirm that this workaround fixed another issue in an Samsung S2 where the game was running very slow. Now it is running smoothly.