NSOpenGLLayer Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.6 and later. |
| Companion guide | |
| Declared in | NSOpenGLLayer.h |
Overview
NSOpenGLLayer is a subclass of CAOpenGLLayer that is suitable for rendering OpenGL into layers. Unlike CAOpenGLLayer, NSOpenGLLayer uses distinctly Application Kit types.
Tasks
Drawing the Content
-
– canDrawInOpenGLContext:pixelFormat:forLayerTime:displayTime: -
– drawInOpenGLContext:pixelFormat:forLayerTime:displayTime:
Managing the Pixel Format
Managing the Rendering Context
Accessing the Associated View
-
viewproperty
Properties
openGLContext
The layer’s NSOpenGLContext.
Discussion
Provides access to the layer's associated NSOpenGLContext. Subclasses shouldn't invoke setOpenGLContext:, but can override it if desired to intercept assignment of the layer's context.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hopenGLPixelFormat
Provides access to the layer's associated NSOpenGLPixelFormat.
Discussion
Subclasses shouldn't invoke setOpenGLPixelFormat:, but can override it if desired to intercept assignment of the layer's pixel format.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hview
Returns the view associated with the layer.
Discussion
Subclasses shouldn't invoke setView:, but can override it if desired to intercept the layer's association to, or dissociation from, a view.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hInstance Methods
canDrawInOpenGLContext:pixelFormat:forLayerTime:displayTime:
Invoked to ask the layer whether it can (or should) draw.
Parameters
- context
The NSOpenGLContext in to which the OpenGL content would be drawn.
- pixelFormat
The pixel format used when the context was created.
- timeInterval
The current layer time.
- timeStamp
The display timestamp associated with timeInterval. Can be
null.
Return Value
YES if the receiver should render OpenGL content, NO otherwise.
Discussion
This method is called before attempting to render the frame for the layer time specified by timeInterval. If the method returns NO, the frame is skipped. The default implementation always returns YES.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hdrawInOpenGLContext:pixelFormat:forLayerTime:displayTime:
Draws the OpenGL content for the specified time.
Parameters
- context
The NSOpenGLContext in to which the OpenGL content would be drawn.
- pixelFormat
The pixel format used when the context was created.
- timeInterval
The current layer time.
- timeStamp
The display timestamp associated with timeInterval. Can be
null.
Discussion
This method is called when a new frame needs to be generated for the layer time specified by timeInterval.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hopenGLContextForPixelFormat:
Returns the OpenGL context to use for the requested pixel format.
Parameters
- pixelFormat
The pixel format.
Return Value
An autoreleased NSOpenGLContext.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.hopenGLPixelFormatForDisplayMask:
Returns the OpenGL pixel format suitable for the specified displays.
Parameters
- mask
A mask specifying the displays the returned
NSOpenGLPixelFormatmust be suitable for.
Return Value
An autoreleased NSOpenGLPixelFormat object suitable for the displays.
Discussion
You must include an NSOpenGLPFAScreenMask specification in the pixel format attribute list that's used to instantiate the NSOpenGLPixelFormat.
Availability
- Available in OS X v10.6 and later.
Declared In
NSOpenGLLayer.h© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-08-18)