Mac Developer Library

Developer

Quartz Core Framework Reference CAOpenGLLayer Class Reference

Options
Deployment Target:

On This Page
Language:

CAOpenGLLayer

CAOpenGLLayer provides a layer suitable for rendering OpenGL content.

To provide OpenGL content you subclass CAOpenGLLayer and override drawInCGLContext:pixelFormat:forLayerTime:displayTime:. You can specify that the OpenGL content is static by setting the asynchronous property to NOfalse.

  • Returns the OpenGL pixel format suitable for rendering to the set of displays specified by the display mask.

    Declaration

    Swift

    func copyCGLPixelFormatForDisplayMask(_ mask: UInt32) -> CGLPixelFormatObj

    Objective-C

    - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask

    Parameters

    mask

    The display mask the OpenGL content will be rendered on.

    Discussion

    This method is called when a pixel format object is needed for the receiver. The default implementation returns a 32bpp fixed point pixelf format, with the NoRecovery and Accelerated flags set.

    You should not call this method directly, it is intended to be overridden by subclasses.

    Availability

    Available in OS X v10.5 and later.

  • Releases the specified OpenGL pixel format object.

    Declaration

    Swift

    func releaseCGLPixelFormat(_ pf: CGLPixelFormatObj)

    Objective-C

    - (void)releaseCGLPixelFormat:(CGLPixelFormatObj)pixelFormat

    Parameters

    pixelFormat

    The pixel format object to release.

    Discussion

    This method is called when the OpenGL pixel format that was previously returned by copyCGLContextForPixelFormat:.

    You should not call this method directly, it is intended to be overridden by subclasses.

    Availability

    Available in OS X v10.5 and later.

  • Returns the rendering context the receiver requires for the specified pixel format.

    Declaration

    Swift

    func copyCGLContextForPixelFormat(_ pf: CGLPixelFormatObj) -> CGLContextObj

    Objective-C

    - (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat

    Parameters

    pixelFormat

    The pixel format for the rendering context.

    Return Value

    A new CGLContext with renderers for pixelFormat.

    Discussion

    This method is called when a rendering context is needed by the receiver. The default implementation allocates a new context with a null share context.

    You should not call this method directly, it is intended to be overridden by subclasses.

    Availability

    Available in OS X v10.5 and later.

  • Releases the specified rendering context.

    Declaration

    Swift

    func releaseCGLContext(_ ctx: CGLContextObj)

    Objective-C

    - (void)releaseCGLContext:(CGLContextObj)glContext

    Parameters

    glContext

    The rendering context to release.

    Discussion

    This method is called when the OpenGL context that was previously returned by copyCGLContextForPixelFormat: is no longer needed.

    You should not call this method directly, it is intended to be overridden by subclasses.

    Availability

    Available in OS X v10.5 and later.