Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] How to draw a Shape to RenderTexture but like an Eraser?  (Read 1124 times)

0 Members and 1 Guest are viewing this topic.

Blaxxun

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • C3D Visualizations
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!
« Last Edit: October 22, 2019, 09:25:32 pm by Blaxxun »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How to draw a Shape to RenderTexture but like an Eraser?
« Reply #1 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.
Laurent Gomila - SFML developer

Blaxxun

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • C3D Visualizations
Re: How to draw a Shape to RenderTexture but like an Eraser?
« Reply #2 on: October 22, 2019, 09:25:09 pm »
It works! Thank you!  :)

 

anything