How can I implement an eraser?

Hello I am developing a simple paint app, but I don’t know how to make an eraser, I mean, something that when y make a CCNode::visit() instead of paint something erase it. The app have to support multilayer, so i was wondering if there is any way for implementing that, or something that can change the alpha of some part of a CCLayer.

Regards

When enabling eraser just update blend functions of node

_ccBlendFunc f = {GL_ZERO,GL_ONE_MINUS_SRC_ALPHA };
brush~~>setBlendFunc;
And when drawing enable update like this
_ccBlendFunc f =;
brush~~>setBlendFunc(f);

brush is the visit node used for drawing

Thank you very much, it works perfectly :slight_smile:

Is there any way we can found the erase percentage? I mean how much texture in term of percenetage still remaining ?