Quartz Dev,
I am converting a real time Core Image filter into an FxPlug, but in
order to that I need to be able to convert in FxTexture into a core
image, run filters, and then write it back out again. I got the first
part, but am not sure how to configure the context to correctly and
efficiently draw to the output texture. can anyone show me the basic
bare bones example of how to simply render the input texture onto the
output texture using Core Image as the intermediary. I can do all the
filtering myself.
Here is what I have so far, which doesn't work. Any assistance would
be much appreciated!!
if ( [inputImage imageType] == kFxImageType_TEXTURE ){
FxTexture *inTex = (FxTexture *)inputImage;
FxTexture *outTex = (FxTexture *)outputImage;
glPushAttrib( GL_CURRENT_BIT );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
[inTex enable];
[inTex bind];
CGLPBufferObj pbuffer;
CIContext *myCIContext;
NSOpenGLPixelFormatAttribute attr[] = {
NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery,
NSOpenGLPFAColorSize, 32,
(NSOpenGLPixelFormatAttribute) 0 };
NSOpenGLPixelFormat* pixelFormat = [[[NSOpenGLPixelFormat alloc]
initWithAttributes:attr] autorelease];
CGLCreatePBuffer(
[outTex width],
[outTex height],
[outTex target],
GL_RGBA,
0,
&pbuffer
);
myCIContext = [CIContext
contextWithCGLContext:renderInfo.sharedContext
pixelFormat:[pixelFormat CGLPixelFormatObj] options:nil];
CGLTexImagePBuffer(renderInfo.sharedContext, pbuffer, GL_BACK);
CGRect rect;
rect.origin.x = 0;
rect.origin.y = 0;
rect.size.width = [outTex width];
rect.size.height = [outTex height];
CIImage *imageBuffer = [[CIImage alloc] initWithTexture:[inTex
textureId] size:rect.size flipped:NO colorSpace:nil];
[myCIContext drawImage:imageBuffer
atPoint:rect.origin //
Should probably be rect.origin
fromRect:rect];
glFlush();
[inTex disable];
glBindTexture ([inTex target], 0);
glPopAttrib();
[imageBuffer release];
CGLDestroyPBuffer(pbuffer);
}
--
- Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden