I’m currently using this method from Apple to take screenshots of my OpenGL ES iPhone game. The screenshots look great. However taking a screenshot causes a small stutter in the game play (which otherwise runs smoothly at 60 fps). How can I modify the method from Apple to take lower quality screenshots (hence eliminating the stutter caused by taking the screenshot)?
Edit #1: the end goal is to create a video of the game play using AVAssetWriter. Perhaps there’s a more efficient way to generate the CVPixelBuffers referenced in this SO post.
The Apple method uses
glReadPixels()which just pulls all the data across from the display buffer, and probably triggers sync barriers, etc, between GPU and CPU. You can’t make that part faster or lower resolution.Are you doing this to create a one-off video? Or are you wanting the user to be able to trigger this behavior in the production code? If the former, you could do all sorts of trickery to speed it up– render to a smaller size for everything, don’t
presentat all and just capture frames based on a recording of the input data running into the game, or other such tricks, or going even further run that whole simulation at half speed to get all the frames.I’m less helpful if you need an actual in-game function for this. Perhaps someone else will be.