CoreImage: EAGLContext or renderbuffer framebuffer configured incorrectly

When I configure GLKViewController / GLKView to draw using CoreImage, I sometimes get a notification in the header.

The setup is as follows:

_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 a UIKit subview in GLKView, and it seems that when I add / remove views, this temporarily pauses the context. The fact is that (with the exception of some rare cases that I still need to deepen) is the next update that I can do in the context without problems.

I am fine to repeat the drawing if it fails, but how can I find out that the context is invalid? How can I detect this or prevent its invalidity?

+6
source share
1 answer

A GLKView sets and manages the render buffer. glGenRenderBuffers() calling glGenRenderBuffers() and glBindRenderbuffer() , you confuse the GLKView configuration.

+1
source

Source: https://habr.com/ru/post/908497/


All Articles