1
votes

In iOS it is easy to setup OpenGL ES 2.0 render to textures and then use those textures for post processing passes or as textures for subsequent rendering passes. That seems like a fairly common approach across OpenGL implementations. All good.

According to Apple's OpenGL ES Programming Guide for iOS (see pages 28 and 29) you can also create and draw to multiple offscreen framebuffer objects. They suggest that you would do this in order to perform offscreen image processing. However, I can't find and description of how you would access the buffers for image processing or any other purpose after rendering to them.

Can these offscreen buffers be used with non-OpenGL frameworks for image processing? Can these buffers be read back by the CPU?

Does anyone have any pointers or examples?

1

1 Answers

1
votes

Image processing is one possible use for offscreen framebuffer objects (FBOs), but there are other applications for this.

For image processing, you most typically would render to a FBO that is backed by a texture. Once you'd rendered to that texture, you could pull that into a second stage of your image processing pipeline or have it be used as a texture in some part of your 3-D scene. As an example of this, my GPUImage open source framework uses a texture-backed offscreen FBO for each filter stage applied to incoming images or video frames. The next stage then pulls in that texture and renders the filtered result to its own texture-backed FBO.

As I said, there can be other applications for offscreen rendering. These included deferred lighting (which Apple has a fairly impressive example of in the 2011 WWDC OpenGL ES videos) and calculation of cached lookup values for later reference. I use the latter as an optimization in my Molecules application to accelerate the mapping of ambient occlusion lighting textures on the surface of my atom spheres. Rather than performing a set of calculations for each fragment of each atom, I render them once for a generic sphere and then look up the results in the atom fragment shader.