CVOpenGLESTextureCacheCreateTextureFromImage error
I am working on updating the second version of the application. Everything was working fine, but all of a sudden I started getting this error. I am using GPUImage library for filtering. I am testing my app on iPhone 6 / iOS 8.3. I checked my old code as well, but I started getting the same error. Can anyone help me to solve this problem.
source to share
We had a caller code CVPixelBufferCreate
that passed in bad parameters. AFAIK this came from some code example, with incorrect copy and paste after, so maybe you have the same error.
CVPixelBufferCreate
accepts a dictionary of attributes. Some of the keys, for example kCVPixelBufferOpenGLESCompatibilityKey
, accept CFBoolean, but we went through a dictionary. This style works:
NSDictionary *attrs = @{ (NSString*)kCVPixelBufferIOSurfacePropertiesKey : @{},
(NSString*)kCVPixelBufferOpenGLESCompatibilityKey: @YES}; <-- we had @{} !
err = CVPixelBufferCreate(kCFAllocatorDefault, width, height, formatType, (__bridge CFDictionaryRef)attrs, &pixelBuffer);
source to share
I am using GPUImage 1.6.0 and am seeing the same problem. Tried to hack the suggested suggestion 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);
source to share
I am getting this solution from Brad Larsen and I think he is right. "If you are filtering directly from the camera, do not use -imageByFilteringImage: and intermediate UIImages. It will be very expensive, both in memory consumption and performance, because you need to convert to UIImages on the CPU. Chained filters from the GPUImageVideoCamera instance. "
source to share