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

Author Topic: Erasing from a RenderTexture with BlendMode Factors  (Read 1547 times)

0 Members and 1 Guest are viewing this topic.

HughPH

  • Newbie
  • *
  • Posts: 13
    • View Profile
Erasing from a RenderTexture with BlendMode Factors
« on: August 22, 2017, 01:43:34 am »
Hi, I'm having a little difficulty understanding the factors and parameters of BlendMode.

The effect I want to achieve is simply to have the destination pixels replaced with rgba(0,0,0,0) - actually it doesn't matter what the R, G, B components are, but let's just say 0 for now.

Am I meant to be putting the SrcColor factor into the SourceFactor, DstColor into the DestinationFactor? Or should I be putting DstColor into both and using Equation.Subtract?

Evidently I'm confused...

(Use case is painting - not drawing sprites or shapes - directly onto parallax layers that slide over one another. So drawing in the background colour that's behind the RenderTexture just isn't an option.)

Many thanks!
« Last Edit: August 22, 2017, 11:45:07 am by HughPH »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Erasing from a RenderTexture with BlendMode Factors
« Reply #1 on: August 22, 2017, 01:20:53 pm »
If you want to replace pixels, then just disable alpha-blending (sf::BlendNone).
Laurent Gomila - SFML developer

HughPH

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Erasing from a RenderTexture with BlendMode Factors
« Reply #2 on: August 22, 2017, 04:31:54 pm »
Thankyou Laurent - and thankyou for creating this awesome library :)

DstAlpha - DstAlpha also works, but I guess that could be slower so I'll try BlendMode.None

 

anything