<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCView/openGLContext()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(cs)QCView(im)openGLContext"
  },
  "title" : "openGLContext()"
}
-->

# openGLContext()

Returns the OpenGL context used by the view.

```
func openGLContext() -> NSOpenGLContext!
```

## Return Value

An `NSOpenGLContext` object.

## Discussion

This context as a read-only object . Do not attempt to change any of its settings. If you subclass `QCView` so that you can perform custom OpenGL drawing, you’ll need to use this method to retrieve the view’s OpenGL context.

## See Also

[`render(atTime:arguments:)`](/documentation/Quartz/QCView/render(atTime:arguments:))

Overrides to perform  your custom operations prior to or after rendering a frame of a composition.



---

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)