<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCRenderer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(cs)QCRenderer"
  },
  "title" : "QCRenderer"
}
-->

# QCRenderer

A base class for low-level rendering.

```
class QCRenderer
```

## Overview

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 <doc://com.apple.documentation/documentation/AppKit/NSOpenGLContext> class or a `CGLContextObj` object. `QCRenderer` also allows you to load, play, and control a composition.

To render a composition to a specific OpenGL context:

- Create an instance of `QCRenderer` using one of the initialization methods, such as [`init(openGLContext:pixelFormat:file:)`](/documentation/Quartz/QCRenderer/init(openGLContext:pixelFormat:file:)).
- Render frames by calling the method [`render(atTime:arguments:)`](/documentation/Quartz/QCRenderer/render(atTime:arguments:))
- If you use double buffering in OpenGL, you must swap the OpenGL buffers.
- Release the renderer when you no longer need it.

This code snippet shows how to implement these tasks:

```objc
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
                                           pixelFormat:format
                                                  file:path];
// 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];
```

## Topics

### Creating and Initializing a Renderer

[`init(composition:colorSpace:)`](/documentation/Quartz/QCRenderer/init(composition:colorSpace:))

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

[`init(openGLContext:pixelFormat:file:)`](/documentation/Quartz/QCRenderer/init(openGLContext:pixelFormat:file:))

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

[`init(cglContext:pixelFormat:colorSpace:composition:)`](/documentation/Quartz/QCRenderer/init(cglContext:pixelFormat:colorSpace:composition:)-7at42)

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

[`init(offScreenWith:colorSpace:composition:)`](/documentation/Quartz/QCRenderer/init(offScreenWith:colorSpace:composition:))

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

### Rendering a Composition

[`render(atTime:arguments:)`](/documentation/Quartz/QCRenderer/render(atTime:arguments:))

Renders a frame of a composition at the specified time.

### Getting the Composition Object

[`composition()`](/documentation/Quartz/QCRenderer/composition())

Returns the composition object associated with the renderer.

### Taking Snapshot Images

[`snapshotImage()`](/documentation/Quartz/QCRenderer/snapshotImage())

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

[`createSnapshotImage(ofType:)`](/documentation/Quartz/QCRenderer/createSnapshotImage(ofType:))

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

### Constants

[Rendering Arguments](/documentation/Quartz/rendering-arguments)

Arguments that you can pass to the [`render(atTime:arguments:)`](/documentation/Quartz/QCRenderer/render(atTime:arguments:)) method.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)