---
title: openGLContext
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsopenglview/openglcontext
---

# openGLContext

The NSOpenGLContext object associated with the receiver.

## Declaration

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

## Discussion

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

### Related Documentation

- [pixelFormat](appkit/nsopenglview/pixelformat.md)

### Managing the NSOpenGLContext

- [prepareOpenGL()](appkit/nsopenglview/prepareopengl().md)
- [clearGLContext()](appkit/nsopenglview/clearglcontext().md)
