Hello,

I am fairly new to CIImage programming. So forgive me if I've missed something obvious.

I try to feed an image port of a Quartz Composer composition with a texture from within a FxPlug. My texture is stored as a FxTexture. I have the sharedContext of the texture and the textureID.

As far as I have seen, I can only feed an NSImage or an CIImage to an image port. I've managed to get it done with an NSImage, but this is way too slow, as I have to copy the texture to a NSBitmapImageRep. Additionally the R and B channels were switched. :-/

So I like to get it to work with an CIImage, as this claims to be working directly with a texture that is already located in the VRAM of the graphics card.

This is my current attempt:

CIContext *myCIContext;
NSOpenGLPixelFormatAttribute attr[] = {
        NSOpenGLPFAAccelerated,
        NSOpenGLPFANoRecovery,
        NSOpenGLPFAColorSize, 32,
        (NSOpenGLPixelFormatAttribute) 0 };
NSOpenGLPixelFormat* pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease]; myCIContext = [CIContext contextWithCGLContext:iInfoTexture.sharedContext pixelFormat: [pixelFormat CGLPixelFormatObj] options:nil];

[textureFX enable];
[textureFX bind];

CGSize sizeOfImage;
sizeOfImage.width = bitmapWidth;
sizeOfImage.height = bitmapHeight;
CIImage *imageBuffer = [[CIImage alloc] initWithTexture:[textureFX textureId] size:sizeOfImage flipped:NO colorSpace:nil];

[_renderer setValue:imageBuffer forInputKey:_inputNameOfImageInput];
[_pixelBufferContext flushBuffer];

[textureFX disable];
[imageBuffer release];

Note: _renderer renders to _pixelBufferContext

Whatever I do, I always wind up with either a crash or the image input shows up in the rendered composition a black rect.

Any ideas ?

Christoph Vonrhein

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to