Reputation: 188
Hello
I want to apply multiple image processing effects to an input texture using OpenGL ES.
I successfully managned to apply one post processing effect using a Framebuffer Object but I do not quite understand how, without repeating every single step of my step of my process, I can apply numerous post processing effect without having to redo every step each time.
The steps I am going through right now are the following:
From what I understand I do need to repeat the step 5,6,7 with my other post processing shader and using the texture I finally got in step 8 but I do not think this is the right way to go as it wil force me to read data from FBO into a texture to then retransfert them which is really costy.
Am I missing something ?
Upvotes: 1
Views: 1511
Reputation: 6766
If your 2 post-processing effects can be done in a single shader then you should do that, it's much more efficient that way because the memory bandwidth costs of reading and writing entire framebuffers often dwarfs the cost of a few extra shader calculations.
However, many post-processing effects need to operate on the finished result of previous post-processing pass. The typical solution is to setup two FBOs and 'ping-pong' between them. So, if you had 3 post-processing effects that need to be chained, you'd have 3 passes:
I think the bit you're missing is that you can use the texture from a framebuffer directly without having to create a brand new texture populated with data from glReadPixels
. This tutorial might help.
Upvotes: 3