---
title: NSOpenGLPixelFormat
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsopenglpixelformat
---

# NSOpenGLPixelFormat

An object that specifies the types of buffers and other attributes of the OpenGL context.

## Declaration

```swift
class NSOpenGLPixelFormat
```

## Overview

Overview To render with OpenGL into an NSOpenGLContext, you must specify the context’s pixel format. Every NSOpenGLPixelFormat object wraps a low-level, platform-specific Core OpenGL (CGL) pixel format object. Your application can retrieve the CGL pixel format object by calling the cglPixelFormatObj method. For more information on the underling CGL pixel format object, see CGL.

## Topics

### Creating an OpenGL Pixel Format

- [init(cglPixelFormatObj:)](appkit/nsopenglpixelformat/init(cglpixelformatobj:)-2zqw4.md)
- [init(attributes:)](appkit/nsopenglpixelformat/init(attributes:).md)

### Managing the Pixel Format

- [cglPixelFormatObj](appkit/nsopenglpixelformat/cglpixelformatobj.md)
- [getValues(_:forAttribute:forVirtualScreen:)](appkit/nsopenglpixelformat/getvalues(_:forattribute:forvirtualscreen:).md)
- [numberOfVirtualScreens](appkit/nsopenglpixelformat/numberofvirtualscreens.md)

### Constants

- [NSOpenGLPixelFormatAttribute](appkit/nsopenglpixelformatattribute.md)
- [OpenGL Pixel Format Attributes](appkit/opengl-pixel-format-attributes.md)
- [OpenGL Profiles](appkit/opengl-profiles.md)

### Initializers

- [init(CGLPixelFormatObj:)](appkit/nsopenglpixelformat/init(cglpixelformatobj:)-6et9a.md)
- [init(coder:)](appkit/nsopenglpixelformat/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Classes

- [NSOpenGLView](appkit/nsopenglview.md)
- [NSOpenGLContext](appkit/nsopenglcontext.md)
- [NSOpenGLLayer](appkit/nsopengllayer.md)
- [NSDrawer](appkit/nsdrawer.md)
- [NSForm](appkit/nsform.md)
- [NSFormCell](appkit/nsformcell.md)
- [NSMenuItemCell](appkit/nsmenuitemcell.md)
