---
title: openGLContext()
framework: quartz
role: symbol
role_heading: Instance Method
path: quartz/qcview/openglcontext()
---

# openGLContext()

Returns the OpenGL context used by the view.

## Declaration

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

## Return Value

Return Value An NSOpenGLContext object.

## Discussion

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

### Related Documentation

- [render(atTime:arguments:)](quartz/qcview/render(attime:arguments:).md)

### Working With OpenGL

- [openGLPixelFormat()](quartz/qcview/openglpixelformat().md)
