CIFilter iOS“程序超出GLES统一限制。”

时间:2015-11-14 23:32:10

标签: ios objective-c image-processing opengl-es photo

出于某种原因,尝试应用CIComicEffect会给我标题中的GLES错误。这是我的代码:

CGImageRef imageRef = imageToPass.CGImage;

CIContext *context = [CIContext contextWithOptions:nil];               // 1

CIImage *image = [CIImage imageWithCGImage:imageRef];               // 2

CIFilter *filter = [CIFilter filterWithName:@"CIComicEffect"];          // 3

[filter setValue:image forKey:kCIInputImageKey];

//[filter setValue:@0.8f forKey:kCIInputIntensityKey];

CIImage *result = [filter valueForKey:kCIOutputImageKey];              // 4

CGRect extent = [result extent];

CGImageRef cgImage = [context createCGImage:result fromRect:extent];   // 5

UIImageOrientation originalOrientation = imageToPass.imageOrientation;
CGFloat originalScale = imageToPass.scale;

imageToPass = [UIImage imageWithCGImage:cgImage scale:originalScale orientation:originalOrientation];

我知道出了什么问题。此外,谷歌搜索几乎没有任何结果。以下是相关的iOS文档:
https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIComicEffect

https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/QuartzCoreFramework/Classes/CIFilter_Class/index.html#//apple_ref/occ/cl/CIFilter

1 个答案:

答案 0 :(得分:1)

我无法查看代码中的位置,但很可能是您反复执行该代码,因此过滤器会反复应用。即,imageToPass既是结果又是下一次迭代的输入。