<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.5.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CAOpenGLLayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CAOpenGLLayer"
  },
  "title" : "CAOpenGLLayer"
}
-->

# CAOpenGLLayer

A layer that provides a layer suitable for rendering OpenGL content.

```
class CAOpenGLLayer
```

## Overview

To provide OpenGL content you subclass `CAOpenGLLayer` and override [`draw(inCGLContext:pixelFormat:forLayerTime:displayTime:)`](/documentation/QuartzCore/CAOpenGLLayer/draw(inCGLContext:pixelFormat:forLayerTime:displayTime:)). You can specify that the OpenGL content is static by setting the [`isAsynchronous`](/documentation/QuartzCore/CAOpenGLLayer/isAsynchronous) property to <doc://com.apple.documentation/documentation/Swift/false>.

## Topics

### Determining Layer Properties

[`colorspace`](/documentation/QuartzCore/CAOpenGLLayer/colorspace)

The layer’s colorspace in Core Graphics.

[`wantsExtendedDynamicRangeContent`](/documentation/QuartzCore/CAOpenGLLayer/wantsExtendedDynamicRangeContent)

Tells whether or not the layer supports content with extended dynamic range.

### Drawing Layer Content

[`asynchronous`](/documentation/QuartzCore/CAOpenGLLayer/isAsynchronous)

Determines when the contents of the layer are updated.

[`-  canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:`](/documentation/QuartzCore/CAOpenGLLayer/canDraw(inCGLContext:pixelFormat:forLayerTime:displayTime:))

Returns whether the receiver should draw OpenGL content for the specified time.

[`-  drawInCGLContext:pixelFormat:forLayerTime:displayTime:`](/documentation/QuartzCore/CAOpenGLLayer/draw(inCGLContext:pixelFormat:forLayerTime:displayTime:))

Draws the OpenGL content for the specified time.

### Managing Pixel Format

[`-  copyCGLPixelFormatForDisplayMask:`](/documentation/QuartzCore/CAOpenGLLayer/copyCGLPixelFormat(forDisplayMask:))

Returns the OpenGL pixel format suitable for rendering to the set of displays specified by the display mask.

[`-  releaseCGLPixelFormat:`](/documentation/QuartzCore/CAOpenGLLayer/releaseCGLPixelFormat(_:))

Releases the specified OpenGL pixel format object.

### Managing the Rendering Context

[`-  copyCGLContextForPixelFormat:`](/documentation/QuartzCore/CAOpenGLLayer/copyCGLContext(forPixelFormat:))

Returns the rendering context the receiver requires for the specified pixel format.

[`-  releaseCGLContext:`](/documentation/QuartzCore/CAOpenGLLayer/releaseCGLContext(_:))

Releases the specified rendering context.

## Relationships

### Conforms To

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CAMediaTiming`](/documentation/QuartzCore/CAMediaTiming)

[`Sendable`](/documentation/Swift/Sendable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSCoding`](/documentation/Foundation/NSCoding)

### Inherits From

[`CALayer`](/documentation/QuartzCore/CALayer)

---

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)