Contents

copyRenderedTexture(forCGLContext:pixelFormat:bounds:isFlipped:)

Returns the name of an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT that contains a subregion of the image in a given pixel format.

Declaration

optional func copyRenderedTexture(forCGLContext cgl_ctx: CGLContextObj!, pixelFormat format: String!, bounds: NSRect, isFlipped flipped: UnsafeMutablePointer<ObjCBool>!) -> GLuint

Parameters

  • cgl_ctx:

    The CGL context to render to.

  • format:

    A string that represents the pixel format of the texture.

  • bounds:

    The bounds of the subregion of the image.

  • flipped:

    Set to True on output if the contents of the returned texture are vertically flipped.

Return Value

The name of an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT that contains a subregion of the image in a given pixel format or 0 if the texture can’t be provided.

Discussion

Implement this method if you want to create the texture yourself or use framebuffer objects (FBO). Use <OpenGL/CGLMacro.h> to send commands to the OpenGL context. Make sure to preserve all the OpenGL states except the ones defined by GL_CURRENT_BIT.

See Also

Rendering an Image to a Destination