---
title: "CVOpenGLTextureCacheCreateTextureFromImage(_:_:_:_:_:)"
framework: Core Video
role: symbol
role_heading: Function
platforms: [macOS 10.4+]
path: "corevideo/cvopengltexturecachecreatetexturefromimage(_:_:_:_:_:)"
---

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

Creates a CVOpenGLTexture object from an existing CVImageBuffer.

## Declaration

```swift
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

Return Value Returns kCVReturnSuccess on success.

## See Also

### Functions

- [CVOpenGLTextureCacheCreate(_:_:_:_:_:_:)](corevideo/cvopengltexturecachecreate(_:_:_:_:_:_:).md)
- [CVOpenGLTextureCacheFlush(_:_:)](corevideo/cvopengltexturecacheflush(_:_:).md)
- [CVOpenGLTextureCacheGetTypeID()](corevideo/cvopengltexturecachegettypeid().md)
