Blur effect for Cocos2D textures on retina displays

I have recently needed to blur a Cocos2d texture to simulate an “out-of-view-field” effect. As it usually happens, it had been already implemented under the name of AWTextureFilter by Manuel Martínez-Almeda, who made it available on github.

Integrating it into my app was really easy, but it turned out that there was a problem with @2x textures on retina displays, both iPhone and the new iPad. So, I just fixed this and published a https://github.com/sdesimone/AWTextureFilter“>fork for anyone who would like to use it.

 Update 27 May:

Due to the lengthy calculations that AWTextureFilter does, it can be pretty slow and block your UI for up to a couple of seconds. Lengthy calculations scream for background execution, but the stock version of AWTextureFilter will not work correctly when executed on a secondary thread due to it eventually calling the Open GL layer.
So I made some changes to blur method and it is now possible to create a blurred texture off the main thread; this will not block the UI. I hope you enjoy it.

Copyright © Labs Ramblings

Built on Notes Blog by TDH
Powered by WordPress

That's it - back to the top of page!