SFML community forums

Help => Graphics => Topic started by: Blaxxun on October 22, 2019, 07:34:01 pm

Title: [SOLVED] How to draw a Shape to RenderTexture but like an Eraser?
Post by: Blaxxun on October 22, 2019, 07:34:01 pm
Hello Forum,

I work on a little drawing tool.
Drawing works fine. But how do i erase with a shape?

I have a circle shape which is my brush.
If i set Alpha to zero. Nothing is drawn. Okay, makes sense.
But how can i use my "brush" to discard already drawn stuff??

Thanks!
Title: Re: How to draw a Shape to RenderTexture but like an Eraser?
Post by: Laurent on October 22, 2019, 08:51:16 pm
Draw your transparent brush with sf::Blend::None rather than the default sf::Blend::Alpha. This way you'll copy transparency instead of applying it.
Title: Re: How to draw a Shape to RenderTexture but like an Eraser?
Post by: Blaxxun on October 22, 2019, 09:25:09 pm
It works! Thank you!  :)