BIT-101 [2003-2017]

Fix for cocos2d color banding


In my first tutorial, I brought up an issue with color banding in gradient pngs used in Sprites in cocos2d. I mentioned a hack that I was using that involved changing a line in the Textures2D class. But I just discovered a better way. These two lines seem to take care of it:

[c][[Director sharedDirector] setPixelFormat:kRGBA8];
[Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];[/c]

And you don’t have to touch the cocos2d source at all.

Note, this works with the currently checked out 0.8 version of the library. Can’t say how it will work with the 0.7.x version.

« Previous Post
Next Post »