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

Author Topic: Clearing only a part of a sf::RenderTexture  (Read 2239 times)

0 Members and 1 Guest are viewing this topic.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Clearing only a part of a sf::RenderTexture
« on: April 23, 2012, 06:21:42 pm »
I was working with a sf::RenderTexture but on which I'd draw diffrent stuff. Now at the beginning the rendertexture gets clear with a fully transparent color thus when exctracting the texture later it will only show something at the place I've drawn something.
The problem is now when I want to remove a drawn square I wont' be able to do this, since I can't clear only a specific area and thus have to clear the whole rendertexture and draw everything again.
If I'd use a non transparent background color it would be easy, I'd just draw a shape over the section I want to remove but you obviously can't draw a transparent shape over something, because it will just shine through.

Am I missing a function here or any other possibilty that doesn't involve direct OpenGL calls or clearing the whole rendertexture?

If not, consider this a feature request... :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Dienes

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Clearing only a part of a sf::RenderTexture
« Reply #1 on: April 23, 2012, 06:48:58 pm »
Somewhat related to the thread we had here:
http://en.sfml-dev.org/forums/index.php?topic=7427.0

Since it seems like you want to clear a rectangular shape, use the method shown by Laurent where you draw a shape with sf::Color::Transparent and sf::BlendNone.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Clearing only a part of a sf::RenderTexture
« Reply #2 on: April 23, 2012, 07:29:33 pm »
Oh right! ;D
sf::BlendNone will do the trick.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/