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

Author Topic: Blurring  (Read 4071 times)

0 Members and 1 Guest are viewing this topic.

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Blurring
« 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,

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Blurring
« Reply #1 on: March 25, 2011, 12:56:35 pm »
You should look into shader.

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Blurring
« Reply #2 on: March 25, 2011, 09:11:39 pm »
Alright, thanks. Now on to the arduous process of compiling another library... ;)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Blurring
« Reply #3 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Blurring
« Reply #4 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.

heishe

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Blurring
« Reply #5 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.

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Blurring
« Reply #6 on: March 28, 2011, 07:52:49 pm »
oh, well I got it all set up with sfml2. But that's good to know.