CIImage display after using CIFilter in GLKView

I always get an error when trying to present a CIImage filtered by CIFilter inside GLKView. Error: "CoreImage: EAGLContext frame buffer or rendering buffer is configured incorrectly! Invalid shader program, possibly due to excess hardware resources. Unable to load kernel!"

The following code that I use to display the image:

- (void)viewDidLoad { [super viewDidLoad]; EAcontext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (!EAcontext) { NSLog(@"Failed to create ES context"); } GLKView *view = (GLKView *)self.view; view.context = self.EAcontext; view.drawableDepthFormat = GLKViewDrawableDepthFormat24; glGenRenderbuffers(1, &_renderBuffer); glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffer); glGenRenderbuffers(1, &_colorBuffer); glBindRenderbuffer(GL_RENDERBUFFER, _colorBuffer); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8_OES, 768, 1024); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _colorBuffer); coreImageContext = [CIContext contextWithEAGLContext:self.EAcontext]; [self updateView]; } - (void)updateView { UIImage *myimage = [UIImage imageNamed:@"Moskau1.jpg"]; CIImage *outputImage = [[CIImage alloc] initWithImage:myimage]; [coreImageContext drawImage:outputImage inRect:self.view.bounds fromRect:[outputImage extent]]; [EAcontext presentRenderbuffer:GL_RENDERBUFFER_OES]; } 

Viewcontroller is a GLKViewcontroller . EAContext is of type CIContext.

What could be the reason for this?

+4
source share
2 answers

"Invalid shader program, possibly due to excess hardware resources" and "Failed to load the kernel!". actually constitute a great mistake, but the former does not seem to have a line. I have this problem yesterday, and there seem to be several sources for this problem:

  • Check the state of the frame buffer to ensure it is complete - glCheckFramebufferStatus(GL_FRAMEBUFFER) should return GL_FRAMEBUFFER_COMPLETE - see the OpenGL ES Programming Guide for an example.

  • In my case, I added a depth buffer to the framebuffer used by Core Image. Obviously, the main image didn’t like it - as soon as I deleted the depth buffer, both error messages disappeared, and Core Image did the trick.

0
source

I had the same problem and removing the depth buffer fixed the error.

0
source

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


All Articles