---
title: prepareOpenGL()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsopenglview/prepareopengl()
---

# prepareOpenGL()

Used by subclasses to initialize OpenGL state.

## Declaration

```swift
func prepareOpenGL()
```

## Discussion

Discussion This method is called only once after the OpenGL context is made the current context. Subclasses that implement this method can use it to configure the Open GL state in preparation for drawing.

## See Also

### Managing the NSOpenGLContext

- [clearGLContext()](appkit/nsopenglview/clearglcontext().md)
- [openGLContext](appkit/nsopenglview/openglcontext.md)
