SFML community forums

Help => Graphics => Topic started by: msteele on March 24, 2011, 08:59:38 am

Title: Blurring
Post by: msteele on March 24, 2011, 08:59:38 am
What is the best way to achieve a gaussian or similar-looking blur effect in or under SFML?

I took a look at this old post http://www.sfml-dev.org/forum/viewtopic.php?t=2667&sid=f57a3d6fdd5f5b99ce991103c43b7c92. It uses motion blur, not gaussian, but even so I figured it would be a start. I couldn't get past. (I have sample code to dissect if you think that will help)
Code: [Select]
Texture "framebuffer" not found in post-effect
Texture "blurred" not found in post-effect


I have also tried this OpenGL technique. It appears to do nothing (in the frame loop: clear->draw->this_opengl->display). I don't know anything about OpenGL though, maybe I missed some initialization?
Code: [Select]
float q = .90;
glAccum(GL_MULT, q);
glAccum(GL_ACCUM, 1-q);
glAccum(GL_RETURN, 1.0);
glFlush();


I am hoping there is a way to do this with SFML that doesn't involve converting between many image representations and carting the whole thing off to another library which I'm not familiar with. But if it does come to that, any suggestions?

Thanks in advance,
Title: Blurring
Post by: Lupinius on March 25, 2011, 12:56:35 pm
You should look into shader.
Title: Blurring
Post by: msteele on March 25, 2011, 09:11:39 pm
Alright, thanks. Now on to the arduous process of compiling another library... ;)
Title: Blurring
Post by: Nexus on March 25, 2011, 09:32:21 pm
Quote from: "msteele"
Now on to the arduous process of compiling another library... ;)
There's no need to, SFML supports shaders. Take a look at sf::Shader and GLSL.
Title: Blurring
Post by: msteele on March 25, 2011, 10:18:44 pm
Quote from: "Nexus"
Quote from: "msteele"
Now on to the arduous process of compiling another library... ;)
There's no need to, SFML supports shaders. Take a look at sf::Shader and GLSL.

Oh, I just meant sfml2. sfml1.6 only has pfx.
Title: Blurring
Post by: heishe on March 28, 2011, 04:34:23 pm
Quote from: "msteele"
Quote from: "Nexus"
Quote from: "msteele"
Now on to the arduous process of compiling another library... ;)
There's no need to, SFML supports shaders. Take a look at sf::Shader and GLSL.

Oh, I just meant sfml2. sfml1.6 only has pfx.


those are exactly the same shaders (pixel/fragment shaders) which sfml 2.0 uses. sfml 2.0 just gets rid of a couple of sfml specific key words in order to make shaders exactly like GLSL shaders.
Title: Blurring
Post by: msteele on March 28, 2011, 07:52:49 pm
oh, well I got it all set up with sfml2. But that's good to know.