# Most efficient way to capture OpenGL ES content of iPhone screen

I'd like to efficiently capture a "screenshot" of my OpenGL ES iPhone game. I put screenshot in quotes because I really want to move the screen contents into a pixel buffer that I can eventually use to create a mov file using AVFoundation.

Currently I'm taking the screenshot with this method from Apple. The resulting image is great... however capturing the image causes a small stutter in my game. Looks like the call to glReadPixels causes the stutter.

How can I capture the screen's contents more efficiently? Perhaps I can improve the efficiency of the call to glReadPixels? Or perhaps I can populate a CMSampleBuffer or CVPixelBuffer without calling glReadPixels?

Perhaps the OpenGL ES data could be accessed directly somehow w/o having to copy the data into a buffer via glReadPixels.

Edit #1: Perhaps a "Frame Buffer Object" could be useful? Or "rendering directly to a texture"?

• Look into pixel buffer objects. Alternatively, create a mode for your game which does not conflict with the additional load on the bus imposed by ReadPixels: Have the next frame rendered after be the frame that would have been rendered next. Your game will run slow but now you'll capture the right ones. Feb 11 '12 at 11:52