A QCRenderer class is designed for low-level rendering of Quartz Composer compositions. This is the class to use if you want to be in charge of rendering a composition to a specific OpenGL context—either using the NSOpenGLContext class or a CGLContextObj object. QCRenderer also allows you to load, play, and control a composition.


@interface QCRenderer : NSObject


To render a composition to a specific OpenGL context:

This code snippet shows how to implement these tasks:

NSOpenGLContext*     context = [myNSOpenGLView openGLContext];
NSOpenGLPixelFormat*  format = [myNSOpenGLView pixelFormat];
NSString*               path = @”/Users/MyName/MyComposition.qtz”;
QCRenderer* myRenderer;
// Create a Quartz Composer renderer.
myRenderer = [[QCRenderer alloc] initWithOpenGLContext:context
// Render the first 10 seconds of the composition with steps of 1/25s.
for(double t = 0.0; t <= 10.0; t += 1.0/25.0)
  [myRenderer renderAtTime:t arguments:nil];
  [context flushBuffer]; //Required on double-buffered contexts
// Clean up
 [renderer release];


Creating and Initializing a Renderer

- initWithComposition:colorSpace:

Creates a renderer object with a composition object and a color space.

- initWithOpenGLContext:pixelFormat:file:

Creates a renderer object with an NSOpenGLContext object and a composition file.

- initWithCGLContext:pixelFormat:colorSpace:composition:

Creates a renderer object with a CGLContextObj object, a pixel format, a color space, and a composition object.

- initOffScreenWithSize:colorSpace:composition:

Creates an offscreen renderer of a given size with the provided color space and composition object.

Rendering a Composition

- renderAtTime:arguments:

Renders a frame of a composition at the specified time.

Getting the Composition Object

- composition

Returns the composition object associated with the renderer.

Taking Snapshot Images

- snapshotImage

Returns an NSImage object of the current image in the OpenGL context associated with the renderer.

- createSnapshotImageOfType:

Returns the current image in the OpenGL context associated with the renderer, as an image object of the provided image type.


Rendering Arguments

Arguments that you can pass to the renderAtTime:arguments: method.


Inherits From