Created
August 31, 2012 15:15
-
-
Save odrobnik/3554385 to your computer and use it in GitHub Desktop.
CoreImage: EAGLContext framebuffer or renderbuffer incorrectly configured!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)drawCIImage:(CIImage *)image | |
{ | |
CGRect rect = [image extent]; | |
// http://stackoverflow.com/questions/8778117/video-filtering-in-iphone-is-slow | |
GLuint _renderBuffer; | |
CGContextRef cgContext; | |
CIContext *coreImageContext; | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
NSUInteger bytesPerPixel = 4; | |
NSUInteger bytesPerRow = bytesPerPixel * rect.size.width; | |
NSUInteger bitsPerComponent = 8; | |
cgContext = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); | |
CGColorSpaceRelease(colorSpace); | |
EAGLContext *glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; | |
coreImageContext = [CIContext contextWithEAGLContext:glContext]; | |
glGenRenderbuffers(1, &_renderBuffer); | |
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffer); | |
[EAGLContext setCurrentContext:glContext]; | |
[coreImageContext drawImage:image atPoint:CGPointZero fromRect:rect]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment