Dear List,
I am trying to draw an image inside QCPlugin render function without any
success.

This is my first plugin so I am new to this and OpenGL. Please note that its
a consumer plugin

- (BOOL) execute:(id<QCPlugInContext>)context atTime:(NSTimeInterval)time
withArguments:(NSDictionary*)arguments

{

CGLContextObj cgl_ctx = [context CGLContextObj];

    GLint             saveMode;

    GLenum      error;

    if(cgl_ctx == NULL)

        return NO;

    CVImageBufferRef pixelBuffer = deckLinkController->getFrameBuffer();

    // Save and set the modelview matrix.

    glGetIntegerv(GL_MATRIX_MODE, &saveMode);

    glMatrixMode(GL_MODELVIEW);

    glPushMatrix();

    // Translate the matrix

    glTranslatef(self.inputX, self.inputY, self.inputZ);

    glScaled(self.inputWidth, self.inputHeight, 1.0);

    // Rotate the matrix

    glRotatef(self.inputAngle, 0.0, 1.0, 0.0);

    if(pixelBuffer)

    {

           CIImage* image = [CIImage imageWithCVImageBuffer:pixelBuffer];

           NSLog(@"%0.0f, %0.0f", [context bounds].size.width, [context
bounds].size.height);

           [ciContext drawImage:image inRect:CGRectMake(0, 0, [context
bounds].size.width, [context bounds].size.height) fromRect:[image extent]];

    }

    // Restore the modelview matrix.

    glMatrixMode(GL_MODELVIEW);

    glPopMatrix();

    glMatrixMode(saveMode);

    // Check for OpenGL errors and log them if there are errors.

    if(error = glGetError())

        [context logMessage:@"OpenGL error %04X", error];

    return (error ? NO : YES);

}


I have initialized the CIContext inside startExecution function

- (BOOL) startExecution:(id<QCPlugInContext>)context

{

     CGColorSpaceRef colorSpace = [context colorSpace];

       ciContext = [[CIContext contextWithCGLContext:

                               (CGLContextObj)[context CGLContextObj]

                                 pixelFormat:CGLGetPixelFormat([context
CGLContextObj])

                                  options:[NSDictionary
dictionaryWithObjectsAndKeys:

                                   (id)colorSpace,kCIContextOutputColorSpace
,

                                   (id)colorSpace,
kCIContextWorkingColorSpace,nil]] retain];

      return YES;

}

Now I am a little confused about inRect and fromRect parameters of drawImage
since the coordinate system is different and which OpenGL function should I
include or remove from this function for it to work.

I can only see a blank screen on top right corner of QC View

Please help,

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

This email sent to arch...@mail-archive.com

Reply via email to