CoreImage: EAGLContext framebuffer or renderbuffer incorrectly configured
Asked Answered
B

1

6

When I setup a GLKViewController/GLKView for drawing with CoreImage I sometimes get the notice in the title.

The setup looks like this:

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

self.view.context = _context;
self.view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
self.view.backgroundColor = UIColor.blackColor;
self.view.contentScaleFactor = UIScreen.mainScreen.scale;

glGenRenderbuffers(1, &_render_buffer);
glBindRenderbuffer(GL_RENDERBUFFER, _render_buffer);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);

_core_image_context = [CIContext contextWithEAGLContext: _context];

[EAGLContext setCurrentContext:_context];

I have UIKit subviews in the GLKView and it seems that when I add/remove views it somehow invalidate the context temporarily. The thing is (except in some rare cases I still need to corner) the next update I can draw in the context without troubles.

I'm ok to retry drawing if it fails but how can I know that the context is invalid? How am I supposed to detect it or prevent it from being invalidated?

Betsey answered 15/2, 2012 at 10:47 Comment(0)
A
1

A GLKView sets up and manages the render buffer. By explicitly calling glGenRenderBuffers() and glBindRenderbuffer() you are confusing the GLKView's configuration.

Antitrust answered 12/12, 2012 at 16:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.