render(withCGLContext:forBounds:)
Renders a subregion of the image to the provided CGL context.
Declaration
optional func render(withCGLContext cgl_ctx: CGLContextObj!, forBounds bounds: NSRect) -> BoolParameters
- cgl_ctx:
The CGL context to render to.
- bounds:
The bounds of the subregion.
Return Value
true if successful; false on failure or if the image provider doesn’t support GPU rendering.
Discussion
The view port is set for you. The model view and projection matrixes are set to the identity.
Your OpenGL code should save and restore all states except for those that are part of GL_CURRENT_BIT (vertex position, color, texture, and so on). Also use CGL macros instead of changing the current context, by including this statement:
#import <OpenGL/CGLMacro.h>
For more details, see Quartz Composer Custom Patch Programming Guide.