I am implementing in Android and my own C ++ script for android using egl 1.1 . Android is currently using glSurfaceView - which allows me to draw on the back buffer that appears at the end of "onDrawFrame" - when replacing the back buffer and front buffer.
My problem with this is - I need to be able to display the back buffer and keep writing as if I weren't swapping. The reason for this requirement is that the scene is very large , and the construction of each frame is impossible, and does not wait for the end of the drawing - since the user will have to wait too long.
In other words - I need to create a scene gradually . At some point during the rendering, I decide the time, and I call eglSwapBuffers , which displays the reverse content from the back buffer, but when I continue to write, I write to the "old front buffer" that is missing sync .. (not containing things that I have done so far).
As far as I can see, the only option is to copy the back buffer before replacing. pseudo:
- Drawing back.
- Copy Back Buffer to temp Buffer
- Exchange
- Copy temporary buffer to (new) buffer back
- Draw extra buffers.
- And so on...
My question is: is there a way to follow steps 2.4?
glCopyPixels useful in this case? Example?- Is
glBlitFramebuffer ?
Or am I not mistaken in this?
What I have already done:
- I tried to set
EGL_SWAP_BEHAVIOR to EGL_BUFFER_PRESERVED , but it only works on certain devices (as described in the cron notes ):
Some surfaces allow applications to control whether the contents of the color buffer are preserved.
- Re-rendering the scene in each frame is not possible. I have read many times that this is recommended.
source share