Class

NSOpenGLContext

An object that represents an OpenGL graphics context, into which all OpenGL calls are rendered.

Declaration

@interface NSOpenGLContext : NSObject

Overview

An OpenGL context is created using an NSOpenGLPixelFormatobject that specifies the context’s buffer types and other attributes. A context can be full-screen, offscreen, or associated with an NSView object. A context draws into its drawable object, which is the frame buffer that is the target of OpenGL drawing operations.

Every NSOpenGLContext object wraps a low-level, platform-specific Core OpenGL (CGL) context. Your application can retrieve the CGL context by calling the CGLContextObj method. For more information on the underling CGL context, see CGL.

Topics

Context Creation

- initWithFormat:shareContext:

Returns an NSOpenGLContext object initialized with the specified pixel format information.

- initWithCGLContextObj:

Initializes and returns a NSOpenGLContext object using an existing CGL context.

Managing the Current Context

+ clearCurrentContext

Sets the current context to nil.

currentContext

Returns the current OpenGL graphics context.

- makeCurrentContext

Sets the receiver as the current OpenGL context object.

Drawable Object Management

- view

Returns the receiver’s view.

- setFullScreen

Sets the receiver to full-screen mode.

- setOffScreen:width:height:rowbytes:

Instructs the receiver to render into an offscreen buffer with the specified attributes.

- clearDrawable

Disassociates the receiver from its viewport.

- update

Updates the receiver's drawable object.

Flushing the Drawing Buffer

- flushBuffer

Copies the back buffer to the front buffer of the receiver.

Copying Attributes

- copyAttributesFromContext:withMask:

Copies selected groups of state variables to the receiver.

Context Parameter Handling

- setValues:forParameter:

Sets the value of the specified parameter.

- getValues:forParameter:

Returns the value of the requested parameter.

Working with Virtual Screens

currentVirtualScreen

Returns the current virtual screen for the receiver.

Creating Textures

- createTexture:fromView:internalFormat:

Creates a new texture from the contents of the specified view.

Getting the CGL Context Object

CGLContextObj

Returns the low-level, platform-specific Core OpenGL (CGL) context object represented by the receiver.

Working with Pixel Buffers

- setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:

Attaches the specified pixel buffer to the receiver.

- pixelBuffer

Returns the pixel-buffer object attached to the receiver.

- pixelBufferCubeMapFace

Returns the cube map face of the pixel buffer attached to the receiver.

- pixelBufferMipMapLevel

Returns the mipmap level of the pixel buffer attached to the receiver.

- setTextureImageToPixelBuffer:colorBuffer:

Attaches the image data in the specified pixel buffer to the texture object currently bound by the receiver.

Constants

NSOpenGLContextParameter

The following attribute names are used by setValues:forParameter: and getValues:forParameter::

Instance Properties

Relationships

Inherits From

Conforms To

See Also

OpenGL

NSOpenGLLayer

A subclass of CAOpenGLLayer that is suitable for rendering OpenGL into layers.

Deprecated
NSOpenGLPixelBuffer

An object that provides access to accelerated offscreen rendering.

Deprecated
NSOpenGLPixelFormat

An object that specifies the types of buffers and other attributes of the NSOpenGLContext.

Deprecated
NSOpenGLGlobalOption

These constants are option names for NSOpenGLSetOption and NSOpenGLGetOption.

Deprecated
NSOpenGLGetOption

Returns global OpenGL options.

Deprecated
NSOpenGLGetVersion

Returns the NSOpenGL version numbers.

Deprecated
NSOpenGLSetOption

Sets global OpenGL options.

Deprecated