Tutorial: Masking Sprites In Cocos2D With CCRenderTexture

Sprite masking can be used to create some very cool image effects.  Things like adding a ragged border around images, hiding body parts of an image can be done easily with sprite masking.

I’ve found a tutorial explaining how to mask sprites within Cocos2D 1.0.  The tutorial explains how to apply a mask to a sprite using CCRenderTexture within Cocos2D.  What’s cool about this is that it is very easy way to add some style and interesting effects to your sprites.

The tutorial is from Ray Wenderlich and can be found here:
How To Mask A Sprite With Cocos2D 1.0

Ray has also written a tutorial on sprite masking with Cocos2D 2.0.  This can be done much more efficiently in Cocos2D 2.0 as it uses OpenGL ES 2.0 so the entire process can be done using shaders.  Keep in mind Cocos2D 2.0 is in an Alpha state right now, but provides some great info if you want to learn about using custom shaders.

You can find the tutorial here:
How To Mask A Sprite With Cocos2D 2.0

Some essential material if you are developing with Cocos2D.  I find the OpenGL ES 2.0 stuff to be quite challenging to understand, but there is definitely a big performance improvement.

©2011 iPhone, iOS 4, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.

.

DeliciousTwitterTechnoratiFacebookLinkedInEmail


Leave a Reply

Your email address will not be published.