A view that displays OpenGL content in a view.


@interface NSOpenGLView : NSView


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.

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.


Initializing an NSOpenGLView

- initWithFrame:pixelFormat:

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

Managing the NSOpenGLPixelFormat


The NSOpenGLPixelFormat object associated with the receiver.

Managing the NSOpenGLContext

- prepareOpenGL

Used by subclasses to initialize OpenGL state.

- clearGLContext

Releases the NSOpenGLContext object associated with the view.


The NSOpenGLContext object associated with the receiver.

Managing the Visible Region

- reshape

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

- update

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


- isOpaque

Returns a Boolean value that indicates whether the view is opaque.

Extended Dynamic Range


Enables extended dynamic range values on the screen.


Inherits From

See Also

Content Views

Browser View

Provide a column-based interface for viewing and navigating hierarchical information.

Collection View

Display one or more subviews in a highly configurable arrangement.

Outline View

Display a list-based interface for hierarchical data, where each level of hierarchy is indented from the previous one.

Table View

Display custom data in rows and columns.


A view that draws text and handles user interactions with that text.