opengl es - iPhone OpenGLES textures - colour banding -


I have a problem with open GL on the iPhone which I'm sure should be a simple solution!

When I load a texture and display it, I get a lot of what is called 'colored banding', from which colors, especially on gradients, are automatically 'customized' ' looks like.

Just to show that it was not wrong in my own code, I downloaded the iPhone 'Crashlanding' app and changed the background image, and as you see in the image below You can see (taken from the simulator), the exact same thing is the image on the left is the original PNG, and on the right it is in the game. It is almost as if this pallet is being reduced to 256 colors.

I am convinced that this is related to the format, I am saving the image, although this can not happen with PNG, it seems that I Image format is selected.

Inserting my head inside! If you want to recreate it, download the crash landing application and change the background. Thank you very much for any help.

iPhone does not support 24-bit color format (8 bits per color) 565 format, red = 5 bits, green = 6 bit, blue = 5 bits

  • 5551 format, red = 5 bits, green = 5 bit, blue = 5 bits, alpha (transparency) - 1 Bit
  • 4444 format, 4 bits for red / green / blue / transparency.
  • So, if you draw a gradient from 0 to 255 in red, you will see 256 gradations in 24 bit format, but only 32 gradations in 565/5551 format or 16 gradations in 4444 Will appear. The 24bit color "is on the fly" is changing, so it seems that it is supported, but it is not.

    That's why color is banding.

    This is true for OpenGL ES 1.0, there is no information about 2.0 /

    Updates : My mistake. IPhones support other formats (8888), but perhaps there might be a conversion in the app?

    Update 2 : Ah, you are using Cocos 2D and do not use transparency in your image (I think) Cocos 2D 565 transforms into a format. I think you need to modify the "Optimization" of Caucus 2D, if you need it.


    Comments