views:

161

answers:

0

So, I know how to take a screenshot with UIKit:

UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
UIGraphicsBeginImageContext(window.bounds.size);
[window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

And I know how to take a screenshot with OpenGL

// Some preparation to read pixels into a buffer
glReadPixels(0,0,backingWidth, backingHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
// Some code to massage the raw pixel data into an image

My app mixes OpenGL and UIKit, so any screenshot taken with just one method doesn't look right.

What's the best way to either a) Composit the two images together or b) Take a screenshot that can capture both OpenGL and UIKit together