1

I'm using GLKViewController with a GLKView, on ios5 works fine, after io6 update glReadPixels stopped to work, and return only black pixels.

I read something about preserveBackBuffer, but o success yet

My setup of GLKView:

_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

if (!_context) {
    DLog(@"Failed to create ES context");
}

GLKView *view = (GLKView *)self.view;
view.context = _context;

Possible path to solution? (I try that here but still don't works)

CAEAGLLayer * eaglLayer = (CAEAGLLayer*) view.layer;
eaglLayer.drawableProperties = @{kEAGLDrawablePropertyRetainedBacking : @(YES)};

I'm using glReadPixels on to record a camera after shader proccess

- (void)captureOutput:(AVCaptureOutput *)captureOutput 
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
   fromConnection:(AVCaptureConnection *)connection

All help be accepted, Thanks,

GTSouza
  • 365
  • 4
  • 16

1 Answers1

0

According to the docs, you should use the 'snapshot' method of GLKView if you need to read the pixels and not glReadPixels. From the docs about 'snapshot':

Discussion: When this method is called, the view sets up a drawing environment and calls your drawing method. However, instead of presenting the view’s contents on screen, they are returned to your application as an image instead. This method should be called whenever your application explicitly needs the contents of the view; never attempt to directly read the contents of the underlying framebuffer using OpenGL ES functions.

Jay Lyerly
  • 457
  • 4
  • 6
  • I'm recording a movie with PixelBuffer from device camera after process shader on openGL, I need know how to re-enable the back buffer of openGL on iOS6 (on iOS5 works perfect...) – GTSouza Sep 25 '12 at 19:38
  • For me the snapshot method is completely unreliable – Paulo Cesar Oct 18 '18 at 10:03