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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Meelusyn

Pages: [1]
1
Graphics / Re: Can't set lower alpha value
« on: August 20, 2020, 12:40:36 am »
Thanks, i didn't know shader wasn't replacing blendmodes;

I put sf::BlendNone instead of the shader and it works, but i am using a shader because i want not to erase all the square of the sprite(i have simplified the code for looking what i was doing wrong);

but when i do
draw(sprite, sf::RenderStates(sf::BlendNone, sprite.getTransform(), sprite.getTexture(), &erasingShader));
it still doesn't work
(when it will works i will put the renderStates as member instead of recreating it each draw call i suppose it would be better ? but here it just for the test)
also i have seen we could use vertex array instead of sprite now, thats great.

Edit : with a renderState outside the calldraw its work :)


2
Graphics / Can't set lower alpha value
« on: August 19, 2020, 07:25:19 pm »
Hello

I'm trying to erase parts of a render_target with a shader by setting the alpha to 0 but it's stay to 1 (255).

here is the fragment shader :
void main() {
     
   gl_FragColor = vec4(0.0, 0.0, 0.0,       0.0       );
}

and here the sfml code :
_renderTarget.clear(sf::Color(0,0,0,      255       ));
_window.clear(sf::Color(255,255,255,255);

_renderTarget.draw(_sprite,&erasingShader);// a 32x32 sprite at mouse location

_renderTarget.display();

sf::Sprite tempSprite(_renderTarget.getTexture());

_window.draw(tempSprite, sf::BlendAlpha);

_window.display();
 

Am I missing something ? it should displays a white square but its all black;




Pages: [1]