Hi, i'm wondering how to mask in SFML 2. I know that someone added a topic to the wiki for SFML 1.6 but i suppose that now that we have RenderImages we can do it with BlendModes, i cannot achieve it though...
I have being trying for a few hours now and stills doesn't work properly. I tried with many techniques but nothing...
The last one i tried was to have the sprite (lready masked) drawn to a black rectangle and then draw that rectangle with blend Add into a transparent surface but it doesn't work it about the same img.
Here is my code so far:
mask_img.Create(640,480);
effects_img.Create(640, 480);
light_img.Create(640, 480);
inter_img.Create(640, 480);
mask_img.Clear(sf::Color(0,0,0,255));
effects_img.Clear(sf::Color(0,0,0,0));
light_img.Clear(sf::Color(0,0,0,255));
{...}
light_img.Draw(BloodHit::sprBlood[0]);
spr_mask.SetBlendMode(sf::Blend::Multiply);
light_img.Draw(spr_mask);
light_img.Display();
spr_inter.SetImage(light_img.GetImage());
spr_inter.SetBlendMode(sf::Blend::Add);
inter_img.Clear(sf::Color(0,0,0,0));
//inter_img.Draw(sf::Shape::Rectangle(420, 340, 8, 8, sf::Color::White));
inter_img.Draw(spr_inter);
inter_img.Display();
This is why I think the substract blendmode should be added xD, to make masking easier. ( I already read some topics about adding BlendModes)
Thanks