Is it possible to render to multiple frame buffers in single pass using OpenGL ES 2.0?
Assume that I have a character and I need to make some image processing on this character before rendering final result. After processing operation, all frame buffers will be combined to one final frame. For example;
Create 5 frame buffers (using
glGenFramebuffers, glGenTextures, glGenRenderbuffers
)- (#1) One for normal map of the character
- (#2) One for depth map of the character
- (#3) One for result texture of processing normal map
- (#4) One for result texture of processing depth map
- (#5) One for final combination of (#3) and (#4) ((#1) and (#2) are used only processing, there isn't any sign of them in the final result)
My question is about (#1) and (#2). Steps to create these buffers as follows:
- Bind frame buffer
- Use related program (depth and normal programs are separated programs)
- Load resources to gpu using
glUniformMatrix4fv, glUniform3f, glBindBuffer, glVertexAttribPointer
etc. (ligths, bone locations etc.) - And render
glDrawElements
- Above steps are repeated for (#1) and (#2) since they have separate programs.
What I want is merge (#1) and (#2) in order to create (#3) and (#4) at once so that resources like bone locations won't be sent to gpu twice.
If additional layers are added for processing (like glowing the moving character) bone locations etc. will be sent to gpu for that glow program too.
What I want is load resources one, create multiple resulting frame buffers.
Above logic may be incorrect at some point, if so please let me know.
Thanks.
Note: OpenGL tag is removed since I'm using ES.