I've noticed in most post processing tutorials several shaders are used one after another: one for bloom, another for contrast, and so on. For example:
postprocessing.quad.bind()
// Effect 1
effect1.shader.bind();
postprocessing.texture.bind();
postprocessing.quad.draw();
postprocessing.texture.unbind();
effect1.shader.unbind();
// Effect 2
effect2.shader.bind();
// ...and so on
postprocessing.quad.unbind()
Is this good practice, how many shaders can I bind and unbind before I hit performance issues? I'm afraid I don't know what the good practices are in open/webGL regarding binding and unbinding resources.
I'm guessing binding many shaders at post processing is okay since the scene has already been updated and I'm just working on a quad and texture at that moment. Or is it more optimal to put shader code in chunks and bind less frequently? I'd love to use several shaders at post though.
Another example of what I'm doing at the moment:
1) Loop through GameObjects, bind its phong shader (send color, shadow, spec, normal samplers), unbind all.
2) At post: bind post processor quad, and loop/bind through different shader effects, and so on ...
Thanks all!