<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOpenGLView/openGLContext",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOpenGLView(py)openGLContext"
  },
  "title" : "openGLContext"
}
-->

# openGLContext

The [`NSOpenGLContext`](/documentation/AppKit/NSOpenGLContext) object associated with the receiver.

```
var openGLContext: NSOpenGLContext? { get set }
```

## Discussion

If the receiver has no associated context object, a new `NSOpenGLContext` object is created. The new object is initialized with the receiver’s pixel format information.

## See Also

[`var pixelFormat: NSOpenGLPixelFormat?`](/documentation/AppKit/NSOpenGLView/pixelFormat)

The [`NSOpenGLPixelFormat`](/documentation/AppKit/NSOpenGLPixelFormat) object associated with the receiver.



---

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)