I do this: but I always get a white image. Does anyone know why?
- (void) screenshotButtonAction{
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
}
self is a uiviewcontroller and it contains an opengl view (UIView + CAEAGLLayer)
EDIT:
I realized that only gl viewing is not shielded. Oddly, the subviews and sublayers of gl gl are clearly visible, but the opengl view is white in the picture. Should this be something with the current context?
This is an AR application, and the gl view shows the camera input + AR objects, so glview is always displayed (updated). What could be here?
source
share