---
title: "init(cglContext:pixelFormat:colorSpace:composition:)"
framework: quartz
role: symbol
role_heading: Initializer
path: "quartz/qcrenderer/init(cglcontext:pixelformat:colorspace:composition:)-7at42"
---

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

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

## Declaration

```swift
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 https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066.
- `composition`: A doc://com.apple.quartz/documentation/Quartz/QCComposition object.

## Return Value

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

## See Also

### Creating and Initializing a Renderer

- [init(composition:colorSpace:)](quartz/qcrenderer/init(composition:colorspace:).md)
- [init(openGLContext:pixelFormat:file:)](quartz/qcrenderer/init(openglcontext:pixelformat:file:).md)
- [init(offScreenWith:colorSpace:composition:)](quartz/qcrenderer/init(offscreenwith:colorspace:composition:).md)
