<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVOpenGLTextureCacheCreateTextureFromImage(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "c:@F@CVOpenGLTextureCacheCreateTextureFromImage"
  },
  "title" : "CVOpenGLTextureCacheCreateTextureFromImage(_:_:_:_:_:)"
}
-->

# CVOpenGLTextureCacheCreateTextureFromImage(_:_:_:_:_:)

Creates a CVOpenGLTexture object from an existing [CVImageBuffer](/documentation/CoreVideo/cvimagebuffer-q40).

```
func CVOpenGLTextureCacheCreateTextureFromImage(_ allocator: CFAllocator?, _ textureCache: CVOpenGLTextureCache, _ sourceImage: CVImageBuffer, _ attributes: CFDictionary?, _ textureOut: UnsafeMutablePointer<CVOpenGLTexture?>) -> CVReturn
```

## Parameters

`allocator`

The `CFAllocatorRef` to use for allocating the `CVOpenGLTexture` object.  May be `NULL`.

`textureCache`

The texture cache object that will manage the texture.

`sourceImage`

The source `CVImageBuffer` for which to create an `CVOpenGLTexture`.

`attributes`

*This parameter is not currently supported and is for future use only.*

    The desired buffer attributes for the     `CVOpenGLTexture`    .

`textureOut`

Upon return, contains the newly created texture.

## Return Value

Returns [`kCVReturnSuccess`](/documentation/CoreVideo/kCVReturnSuccess) on success.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)