Login  Register

Re: Best way to scene incremental drawing

Posted by EvilMax on May 11, 2015; 2:05pm
URL: https://forum.jogamp.org/Best-way-to-scene-incremental-drawing-tp4034213p4034461.html

After some research, I think I understood the way to implement required. But need help of community to check and now instead of very general question have small and concrete. Hope, you can help me. What I can see from GL tutorials, FBO docs and some engines code. To render incrementally I need to have FBO with Render Buffer attached with storage (texture where to render) and depth buffer. Procedure I've used:
1. Render back face of bounding box to texture
2. Put texture onto the input of second shader program
3. Switch to default (window system provided) framebuffer
4. Render to screen.

What should I do to render incrementally:

1. Render everything from all objects that want to draw themselves to FBO (offscreen). So, depth will be preserved and no breaking.
2. Display FBO contents on screen.

Two questions.

First: how to do FBO contents displaying faster? Now I see only following the following possibilities:

1. Blit framebuffer via glBlitFramebuffer displaying contents of the FBO on the default framebuffer.
2. Initially add texture attachment and at last stage draw fullscreen quad and copy data in fragment shader.
From Song Ho i think (2) could be faster, but I am not sure that these are the only ways to do task.

Second: what to do if one of the objects have complex rendering and requres to generate its own framebuffer? Generate new, switch, draw and then perform operation above (switch to previous framebuffer and render final result there) or else?