Class

NSOpenGLView

An NSOpenGLView object maintains an NSOpenGLPixelFormat and NSOpenGLContext object into which OpenGL calls can be rendered. The view provides methods for accessing and managing the NSOpenGLPixelFormat and NSOpenGLContext objects, as well as notifications of visible region changes.

Overview

An NSOpenGLView object cannot have subviews. You can, however, divide a single NSOpenGLView into multiple rendering areas using the glViewport function.

When creating an NSOpenGLView object in Interface Builder, you use the inspector window to specify the pixel format attributes you want for the view. Only those attributes listed in the Interface Builder inspector are set when the view is instantiated.

Symbols

Initializing an NSOpenGLView

init?(frame: NSRect, pixelFormat: NSOpenGLPixelFormat?)

Returns an NSOpenGLView object initialized with the specified frame rectangle and pixel format.

Managing the NSOpenGLPixelFormat

Managing the NSOpenGLContext

func prepareOpenGL()

Used by subclasses to initialize OpenGL state.

func clearGLContext()

Releases the NSOpenGLContext object associated with the view.

var openGLContext: NSOpenGLContext?

The NSOpenGLContext object associated with the receiver.

Managing the Visible Region

func reshape()

Called by Cocoa when the view's visible rectangle or bounds change.

func update()

Called by Cocoa when the view’s window moves or when the view itself moves or is resized.

Relationships

Inherits From

Conforms To