4

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;

  1. 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)
  2. 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.

JeJoRic
  • 95
  • 6
  • 2
    I don't really understand what you are trying to do. Your "Load everything to gpu for each fbo" statement doesn't really make sense to me. Can you be more specific? What do these FBOs represent, and how do you load stuff for an FBO? Also, are you using desktop OpenGL or OpenGL ES 2.0, because they're not the same thing. – Nicol Bolas Jul 22 '18 at 02:44
  • @NicolBolas Hi. I have added some details and removed OpenGL tag. Thanks for the comment. – JeJoRic Jul 22 '18 at 12:08

0 Answers0