I am looking for a minimal example where each frame will reuse the triangles from the previous frame. I have been trying over and over unsuccessfully, so I do not have any code worth showing, although I do have a program that works by drawing to the default framebuffer.
During on draw I would add new triangles to a framebuffer object, and the frame would be copied to the default framebuffer. Since I would not clear the frame buffer object, it would retain its rgba values and depths, so that when I add more triangles the next frame, the previous ones would still remain. (Later I will reduce the alpha value of the triangles from previous frames to produce a fade effect, but for simplicity sake reuse the previous triangles exactly as they are is fine.)
I am finding it very difficult to understand how the frame buffer object works, and whether or not I need to create render, depth, and texture buffers. I suspect that I need render and depth buffers since I would like to retain that information between draws but do not need the texture buffer.
I thought the onDrawFrame method would look something like this:
- New data is added to the framebuffer object.
- The default framebuffer is cleared.
- The information from the framebuffer object is copied to the default framebuffer and then the default framebuffer is rendered.
I believe I am doing steps 1 and 2 correctly by binding the framebuffer object, the renderbuffer, and the depth buffer, but I cannot figure out a means of copying from one framebuffer to another.