Deprecated CIContext Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.6

contextWithCGLContext:pixelFormat:options:

Creates a Core Image context from a CGL context, using the specified options and pixel format object. (Deprecated in Mac OS X v10.6.)

+ (CIContext *)contextWithCGLContext:(CGLContextObj)ctx pixelFormat:(CGLPixelFormatObj)pf options:(NSDictionary *)dict

Parameters
ctx

A CGL context (CGLContextObj object) obtain by calling the CGL function CGLCreateContext.

pf

A CGL pixel format object (CGLPixelFormatObj object) created by calling the CGL function CGLChoosePixelFormat. This argument must be the same pixel format object used to create the CGL context. The pixel format object must be valid for the lifetime of the Core Image context. Don’t release the pixel format object until after you release the Core Image context.

options

A dictionary that contains color space information. You can provide the keys kCIContextOutputColorSpace or kCIContextWorkingColorSpace along with a CGColorSpaceRef object for each color space.

Discussion

After calling this method, Core Image draws content into the surface (drawable object) attached to the CGL context. A CGL context is an Mac OS X OpenGL context. For more information, see OpenGL Programming Guide for Mac OS X.

When you create a CIContext object using a CGL context, all OpenGL states set for the CGL context affect rendering to that context. That means that coordinate and viewport transformations set on the CGL context as well as the vertex color.

For best results, follow these guidelines when you use Core Image to render into an OpenGL context:

Some typical initialization code for a view with width W and height H is:

    glViewport (0, 0, W, H);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    glOrtho (0, W, 0, H, -1, 1);
    glMatrixMode (GL_MODELVIEW);
    glLoadIdentity ();
    glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    glEnable (GL_BLEND);
Availability
See Also
Related Sample Code
Declared In
CIContext.h


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-03-16)