I’m developing an Android application type finger paint. I’m using OpenGL ES 2.0. Basically I have an image where every touch screen should correspond to a circle alpha to be applied where it is shown the other image that lies beneath. I tried different techniques but are rather slow because it functions like using organic glTexSubImage2D that slow down the rendering phase. I’m trying to understand the use of FBO as they allow the off-screen rendering. Can someone explain better what it means rendering off-screen and what advantages could obtain to speed up my method?
I suppose off-screen means you can change the framebuffer created by me, out of the way onDrawFrame? In another thread?
well fbo is a renderable buffer, which contents you can use as a basic texture. so you render some scene into a frame buffer, but it won’t appear on screen by itself(that’s why it’s called offscreen rendering). it renders directly to texture, which you specify. so you can sample it as a regular 2d-texture. you can render a fullscreen quad, which samples it and applies some effect. or you can use it as a texture for any kind of geometry.
or you can create two framebuffers and switch them every frame. so one of them contains previous frame and the second is used to sample the other one(to use previous frame as a background) and add new stuff(like render a quad with brush texture on finger tap) to it. so you kinda change the contents of previous frame, but without using expensive call for writing to texture.
my english is not good enough to explain it properly, but technique is called “ping-pong between framebuffers”. first you should read some articles about framebuffers, like that one or that one . and after you’ve learned to use them, you’ll probably figure out how to achieve what you want. or you can google on how to ping-pong between FBO’s.