[mono-android] Color Woes.

Danny dannylisher at lycos.com
Sun Feb 26 15:14:25 UTC 2012


I'm having a small problem with colors and OpenTK.
I'm just getting started with monodroid, and I have hit a sort of a road
block.

I've used OpenTK before (for windows) so I am familiar with it already; when
loading a texture, if the emulator is set to have a 16-bit screen depth, the
red/blue color channels get swapped, in the past when I have used OpenTK, I
have had to set the PixelFormat to BGRA to make png's work.

This doesn't appear to be an option in monodroid, so to fix it, I used gimp
and swapped the two color channels, and the image then rendered correctly.

problem solved, or at least I thought.

until i tried the emulator with a 32-bit screen depth, on devices with a 32
bit screen depth the two channels do not get swapped, and so the image is
now inverted as it was in the first case (unless I use the original
none-channel inverted image, in which case it renders fine) this suggests I
can solve this problem by storing two copies of all my images, one for 16
bit screens, and 1 for 32 bit screens.

so my question is; is there a proper solution to this?
some way to avoid the channels getting swapped in the first place, so I only
have to use one copy.
or alternatively some way to detect the screen depth, so I can load the
appropriate image for the device.

Thanks for your time.

Original Image:
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/Foreground_1_1.png 
How it appears on 16 bit screens:
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/16bit.png 
How it appears on 32 bit screens:
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/32bit.png 

Dirty fix (swapped color channels in gimp):
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/Foreground_1_1.png 
how it looks on 16 bit screens:
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/16bit_flip.png 
how it looks on 32 bit screens:
http://mono-for-android.1047100.n5.nabble.com/file/n5516814/32bit_flip.png 

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Color-Woes-tp5516814p5516814.html
Sent from the Mono for Android mailing list archive at Nabble.com.


More information about the Monodroid mailing list