I'd like to rapidly capture "screenshots" of my OpenGL ES iPhone game and turn them into a video. I've tried the following approach (it works but degrades the game play to an unacceptable level):
- Use
glReadPixels
to copy the data from the framebuffer to aGLubyte
array. Create aCGImageRef
from that data. Then create aCVPixelBuffer
from theCGImageRef
. Finally append theCVPixelBuffer
to anAVAssetWriter
.
I've done a fair amount of additional research. Some people suggest copying the framebuffer and reading that piecewise with glReadPixels
. This could work... but I don't know how to copy a framebuffer. (any help is appreciated!)
I just learned that the iPhone's "VRAM" is really part of the main memory. How can I read the contents of a framebuffer from "VRAM" without calling glReadPixels
?
Hopefully this approach (or similar) will keep the frame rate of the game acceptable.