---
title: "init(cglPixelFormatObj:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsopenglpixelformat/init(cglpixelformatobj:)-2zqw4"
---

# init(cglPixelFormatObj:)

Returns an OpenGL pixel format object initialized with using an existing CGL pixel format object.

## Declaration

```swift
init?(cglPixelFormatObj format: CGLPixelFormatObj)
```

## Parameters

- `format`: An existing CGL pixel format object.

## Return Value

Return Value An intialized NSOpenGLPixelFormat object that wraps the CGL pixel format object.

## Discussion

Discussion If your application already has a low-level CGL pixel format object, you can create an NSOpenGLPixelFormat object to wrap it by calling this initializer. The NSOpenGLPixelFormat object retains the CGL pixel format object by calling the CGLRetainPixelFormat(_:) function. Your application should not call CGLDestroyPixelFormat(_:) to dispose of the CGL pixel format object. Instead, your application should call CGLReleasePixelFormat(_:) to decrement its reference count.

## See Also

### Creating an OpenGL Pixel Format

- [init(attributes:)](appkit/nsopenglpixelformat/init(attributes:).md)
