Initializes an image object with data supplied by an OpenGL texture.
SDK
- macOS 10.9–10.14Deprecated
Framework
- Core Image
Declaration
init(texture name: UInt32, size: CGSize, flipped: Bool, options: [CIImage Option : Any]? = nil)
Parameters
name
An OpenGL texture. Because
CIImage
objects are immutable, the texture must remain unchanged for the life of the image object. See the discussion for more information.size
The dimensions of the texture.
flag
true
to have Core Image flip the coordinates of the texture vertically to convert between OpenGL and Core Image coordinate systems.options
A dictionary specifying image options. (See Image Dictionary Keys.)
Return Value
The initialized image object.
Discussion
When using a texture to create a CIImage
object, the texture must be valid in the Core Image context (CIContext
) that you draw the CIImage
object into. This means that one of the following must be true:
The texture must be created using the
CGLContext
object that theCIContext
is based on.The context that the texture was created in must be shared with the
CGLContext
that theCIContext
is based on.
Note that textures do not have a retain and release mechanism. This means that your application must make sure that the texture exists for the life cycle of the image. When you no longer need the image, you can delete the texture.
Core Image ignores the texture filtering and wrap modes (GL
and GL
) that you set through OpenGL. The filter and wrap modes are overridden by what the CISampler object specifies when you apply a filter to the CIImage
object.