How to create a 32RGBA CVPixelBuffer for iPhone?

When I try to create a 32-bit RGBA CVPixelBuffer, I constantly get errors.

The first error is -6680, which means: "The buffer does not support the specified pixel format."

This is a piece of code: (Width and height are specified as 256 * 256)

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
//                         [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
//                         [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
//                         [NSNumber numberWithBool:YES], kCVPixelBufferOpenGLCompatibilityKey,
                         nil];
CVPixelBufferRef pxbuffer = NULL;
CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, WIDTH,
                                      HEIGHT, kCVPixelFormatType_32RGBA, (CFDictionaryRef) options, 
                                      &pxbuffer);
NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL);

Can someone tell me what I'm doing wrong?

+5
source share
1 answer

. , , 32RGBA, , . ( ) , , , :

Q & A QA1501 Core Video -

, , 32ARGB 32BGRA.

+7

All Articles