I want to perform some post-processing effects in OpenGL and right now I'm particularly interested in blurring.
I found the following article which seems simple enough:
Gaussian Blur Filter Shader. It gives you the shader code which you need to use and the following directions:
1. Render the scene you want to blur to a texture (could be downsampled)
2. Render a screen aligned quad with the horizontal blur shader to a texture
3. Render a screen aligned quad with the vertical blur shader to the screen or texture depending on what you want to use it for
Right now I'm creating an FBO, attaching a texture to it and rendering stuff to that texture, but I'm unsure on how to proceed.
Do I apply horizontal blurring to the texture, then take the result of that process and apply vertical blurring to it, then take the result of that and render it to the screen?
Or do I render the original texture to the screen, then apply horizontal blurring to the original texture and render the result of that process to the screen, then apply vertical blurring to the original texture and render that to the screen? It would be kind of like a three-layered sandwich: original texture + original texture blurred horizontally + original texture blurred vertically.
Or do I render the original texture to the screen, then apply horizontal blurring to the original texture, then apply vertical blurring to the horizontally blurred texture and render the result of that process to the screen? If I do that, it would be like a two-layered sandwich: original texture + original texture blurred horizontally
and vertically.
Am I on the right track? Also, if you know of any other good articles about post-processing effects in OpenGL using shaders (especially about blur filters), feel free to post them.