4
votes

Shaders can not read data from framebuffer, they can pass data only forward by rendering pipeline. But for post-processing it is needed to read rendered image.

I'm going to resolve this as following: 1) create a texture with size of viewport; 2) render image to the texture normally; 3) render the texture to framebuffer passing it through post-processing shader.

Am I doing right? Are there more effective ways to do post-processing?

1
Depends on the parameters required for post processing. Do you want the entire image to be drawn for the post processing to start? - Ramya Maithreyi
Yes, I do. For example, I want to distort final image as if it is reflected in distorting mirror. - Lavir the Whiolet

1 Answers

5
votes

That is indeed the usual way to do post-processing ! Render to texture by binding an FBO for your first pass, then use that texture as the input of your post-process shader after unbinding your FBO (i.e. returning to the default frame buffer).