Opengl draw to a texture and blur

I am trying to do some simple blur effect with Opengl.
The Nehe tutorial about bluring is too complicated to convert to openframeworks.
http://nehe.gamedev.net/data/lessons/le-…-?lesson=36
is there any easier way to do real time blur effect in Openframeworks? I guess draw the Opengl scene to a texture and blur it?

If you’re not stuck with opengl, there is an easy way of doing it in opencv. ofxCvImage has a blur() and gaussianBlur() method.

Also, the tutorial you point to is for implementing a radial blur rather than a regular kernel-based blur (which is why it’s so complicated).

If you want to render to texture you would need a frame buffer, i belive there are a few ofx
addons for this, but it’s not overly complicated if you google for opengl fbo, there are a few
good tutorials out there, I used the following ones when I wrote my FBO class:

Frame Buffer Object 101
http://www.gamedev.net/reference/articl-…-le2331.asp

Frame Buffer Object 201
http://www.gamedev.net/reference/progra-…-ures/fbo2/

More or less what you do is attach a frame buffer and render as usual, the stuff will not
be drawn on screen but instead be drawn offscreen into your buffer object.

For blurring you could do a simple kernel based shader blur, there are plenty of them out
there if you don’t feel like rolling your own.

If you want to first render to a texture, then then render the blurred result into another one,
before doing something different with the final output, then remember that you can attach
more then one color buffer (texture) to a framebuffer object. It’s faster to swap colorbuffers
within a framebuffer rather then swapping framebuffers all togheter.

  • Edvin

Thanks for both of you. I think the OpenCV might be the easiest.
however, I would like to try the FBO as well, and see what happens!