I develop 3d menu and sometimes I need to blur only part of the screen. I use a forward rendering. I create a frame buffer object with 3 color attachments. Rendering looks like this:
- bind fbo
- render objects which are blurred to the first texture
- bind the first texture
- perform vertical blur and save a result in the second texture
- bind the second texture
- perform horizontal blur and save a result in the third texture
- unbind fbo (render to the default fbo)
- bind the thrid texture
- render the third texture
- render objects which are not blurred
I can use subroutines to reduce overhead during switching shaders. I also found the following article . Do you have any other ideas how to optimize above rendering ?