Hi,
I just thinking about simple/naive defferend rendering implementation and I like to consult, if is my ideas correct.
So Im going to have color, depth, normal buffers.
Every my "entity" in scene graph have pair of vertex and pixel shader with final "program" reference.
So I have to do first pass which will iterate over entities, binds their programs, bind color buffer and draw the one by one.
After that I have to fill for example normal buffer, so I will iterate again, but I have to "swap" the pixel shader of every entity with my "normal" pixel shader. But this is going to be expensive right? To compile, in OpenGL terms, the program with new fragment shader (maybe I can do it upfront?).
Suppose for now this is correct way and I will do next pass which will fill depth buffer in same way.
After these passes I have to bind "screen quad" entity (suppose we don't use lighting right now) and bind those buffers (color, depth, normal) and write shader which will combine information from those buffers and outputs final image.
So my questions are - what is the "best practice" how to fill my custom (color, depth, normal, maybe so more) buffers? Also - is this flow as whole right?
Thank you for help!