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

Author Topic: Apply shader to whole screen?  (Read 3529 times)

0 Members and 1 Guest are viewing this topic.

TheGuerilla

  • Newbie
  • *
  • Posts: 27
  • Cynical Prick.exe
    • View Profile
    • Email
Apply shader to whole screen?
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Apply shader to whole screen?
« Reply #1 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
Laurent Gomila - SFML developer

TheGuerilla

  • Newbie
  • *
  • Posts: 27
  • Cynical Prick.exe
    • View Profile
    • Email
Re: Apply shader to whole screen?
« Reply #2 on: May 08, 2016, 09:40:57 pm »
Thanks! The latter suggestion seems good for my situation.