SFML community forums

Help => Graphics => Topic started by: TheGuerilla on May 08, 2016, 08:51:51 am

Title: Apply shader to whole screen?
Post by: TheGuerilla on May 08, 2016, 08:51:51 am
(I know I messed up a couple times and put some topics in this wrongfully, but I'm like 99% sure this is the right thread for this question.)

So I've got GLSL shaders/sf::Shader to work now with some test shaders (Basically just setting the pixel black...), and now I'm wondering if its possible to apply a shader to the whole screen; since you can't apply something like a scanline or blurring shader to each individual drawn thing; it would look atrocious.

Thanks in advance
Title: Re: Apply shader to whole screen?
Post by: Laurent on May 08, 2016, 09:18:04 am
Quote
I'm like 99% sure this is the right thread for this question
Shaders belong to the graphics module, and this is a help request, so yes this is indeed the perfect place ;)

Quote
I'm wondering if its possible to apply a shader to the whole screen
There are two ways:
- draw everything to a render-texture, then draw this render-texture with a fullscreen sprite and apply the shader
- use sf::Texture::update(Window&) to get the content of the framebuffer into a texture, then draw this texture with a fullscreen sprite and apply the shader
Title: Re: Apply shader to whole screen?
Post by: TheGuerilla on May 08, 2016, 09:40:57 pm
Thanks! The latter suggestion seems good for my situation.