WasimSafdar
WasimSafdar

Reputation: 1132

CVOpenGLESTextureCacheCreateTextureFromImage error

I am working on app second version update. Everything was working fine but suddenly I started getting this error. I am using GPUImage library for filtering. I am testing my app on iPhone 6/iOS 8.3. I also checked my old code but I started getting same error. Anybody help me to resolve this issue.

Error in GPUImageFrameBuffer

Upvotes: 3

Views: 2221

Answers (3)

Eli
Eli

Reputation: 7

I am using GPUImage 1.6.0 and see the same issue. Tried to hack with the suggested proposal - but it didn't help. Any other ideas/suggestions?

CFDictionarySetValue(attrs, kCVPixelBufferIOSurfacePropertiesKey, empty);
CFDictionarySetValue(attrs, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue);

CVReturn err = CVPixelBufferCreate(kCFAllocatorDefault, (int)_size.width, (int)_size.height, kCVPixelFormatType_32BGRA, attrs, &renderTarget);

Upvotes: 0

WasimSafdar
WasimSafdar

Reputation: 1132

I get this solution from Brad Larsen and I think he is right. "If you're doing filtering directly from the camera, don't use -imageByFilteringImage: and intermediary UIImages. This will be horribly expensive, both in memory consumption and performance, because you have to convert to and from UIImages on the CPU. Instead, chain filters from a GPUImageVideoCamera instance."

Upvotes: 0

Graham Perks
Graham Perks

Reputation: 23400

We had some code calling CVPixelBufferCreate that was passing bad parameters. AFAIK this came from some sample code, with some bad copy & pasting after, so perhaps yours has the same error.

CVPixelBufferCreate takes an attributes dictionary. Some of the keys, like kCVPixelBufferOpenGLESCompatibilityKey take a CFBoolean, but we were passing a dictionary. This style works:

NSDictionary *attrs = @{ (NSString*)kCVPixelBufferIOSurfacePropertiesKey : @{},
                         (NSString*)kCVPixelBufferOpenGLESCompatibilityKey: @YES}; <-- we had @{} !

err = CVPixelBufferCreate(kCFAllocatorDefault, width, height, formatType, (__bridge CFDictionaryRef)attrs, &pixelBuffer);

Upvotes: 2

Related Questions