CAOpenGLLayer provides a layer suitable for rendering OpenGL content.


To provide OpenGL content you subclass CAOpenGLLayer and override draw(inCGLContext:pixelFormat:forLayerTime:displayTime:). You can specify that the OpenGL content is static by setting the isAsynchronous property to false.


Managing the pixel format

func copyCGLPixelFormat(forDisplayMask: UInt32)

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

func releaseCGLPixelFormat(CGLPixelFormatObj)

Releases the specified OpenGL pixel format object.

Managing the rendering context

func copyCGLContext(forPixelFormat: CGLPixelFormatObj)

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

func releaseCGLContext(CGLContextObj)

Releases the specified rendering context.


Inherits From

Conforms To

See Also

Metal and OpenGL

class CAMetalLayer

A layer that manages a pool of Metal drawables.

protocol CAMetalDrawable

A displayable resource that can be rendered or written to by Metal.

class CAEAGLLayer

A layer that supports drawing OpenGL content in iOS and tvOS applications.

class CARenderer

A layer that allows an application to render a layer tree into a Core OpenGL (CGL) context.