Add outline/border to sprite (with masking)


#1

Im trying to find a way to add an outline or border to a sprite.

Basically I’m generating a texture using CCRenderTexture, and using the mask image to “cut out” my desired sprite shape.

So an easy example, would be using a circlur mask to give me a nice circle with the texture color.
In the case of the circle though I would like to add some form of border so that it stands out from the background.

This needs to work for irregular shapes also, not just primative shapes.

Im not do familiar with opengl blend modes, is there a way to do this using the masking technique (perhaps another blend cicle)? or another way with cocos2d.

My current Masking code.

ccBlendFunc blenderMask = {GL_ONE, GL_ZERO}
maskSprite~~>setBlendFunc;
ccBlendFunc blenderTex =
textureSprite~~>setBlendFunc(blenderTex );

rt~~>begin
maskSprite~~>visit();
textureSprite~~>visit;
rt~~>end();