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

# NSOpenGLLayer

A subclass of `CAOpenGLLayer` that is suitable for rendering OpenGL into layers.

```
class NSOpenGLLayer
```

## Overview

Unlike <doc://com.apple.documentation/documentation/QuartzCore/CAOpenGLLayer>, [`NSOpenGLLayer`](/documentation/AppKit/NSOpenGLLayer) uses AppKit types.

## Topics

### Drawing the Content

[`canDraw(in:pixelFormat:forLayerTime:displayTime:)`](/documentation/AppKit/NSOpenGLLayer/canDraw(in:pixelFormat:forLayerTime:displayTime:))

Invoked to ask the layer whether it can (or should) draw.

[`draw(in:pixelFormat:forLayerTime:displayTime:)`](/documentation/AppKit/NSOpenGLLayer/draw(in:pixelFormat:forLayerTime:displayTime:))

Draws the OpenGL content for the specified time.

### Managing the Pixel Format

[`openGLPixelFormat`](/documentation/AppKit/NSOpenGLLayer/openGLPixelFormat)

Provides access to the layer’s associated OpenGL pixel format.

[`openGLPixelFormat(forDisplayMask:)`](/documentation/AppKit/NSOpenGLLayer/openGLPixelFormat(forDisplayMask:))

Returns the OpenGL pixel format suitable for the specified displays.

### Managing the Rendering Context

[`openGLContext`](/documentation/AppKit/NSOpenGLLayer/openGLContext)

The layer’s OpenGL context.

[`openGLContext(for:)`](/documentation/AppKit/NSOpenGLLayer/openGLContext(for:))

Returns the OpenGL context to use for the requested pixel format.

### Accessing the Associated View

[`view`](/documentation/AppKit/NSOpenGLLayer/view)

Returns the view associated with the layer.



---

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)