<!--
{
  "availability" : [
    "macOS: 10.5.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCRenderer/init(cglContext:pixelFormat:colorSpace:composition:)-7at42",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(cs)QCRenderer(im)initWithCGLContext:pixelFormat:colorSpace:composition:"
  },
  "title" : "init(cglContext:pixelFormat:colorSpace:composition:)"
}
-->

# init(cglContext:pixelFormat:colorSpace:composition:)

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

```
init!(cglContext context: CGLContextObj!, pixelFormat format: CGLPixelFormatObj!, colorSpace: CGColorSpace!, composition: QCComposition!)
```

## Parameters

`context`

A  `CGLContextObj` object. The object that you supply must have both a color and a depth buffer.

`format`

A  `CGLPixelFormatObj`  object.

`colorSpace`

A Quartz color space object. This must be an RGB color space. Pass `NULL` to use the default RGB color space. For more information on Quartz color spaces, see [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066).

`composition`

A [`QCComposition`](/documentation/Quartz/QCComposition) object.

## Return Value

The initialized `QCRenderer` object or `nil` if initialization is not successful.

---

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)