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

# CVOpenGLBufferCreate(_:_:_:_:_:)

Creates a new Core Video OpenGL buffer that can be used for OpenGL rendering purposes

```
func CVOpenGLBufferCreate(_ allocator: CFAllocator?, _ width: Int, _ height: Int, _ attributes: CFDictionary?, _ bufferOut: UnsafeMutablePointer<CVOpenGLBuffer?>) -> CVReturn
```

## Parameters

`allocator`

The allocator to use to create the Core Video OpenGL buffer. Pass `NULL` to specify the default allocator.

`width`

The width of the buffer in pixels.

`height`

The height of the buffer in pixels.

`attributes`

A Core Foundation dictionary containing other desired attributes of the buffer (texture target, internal format, max mipmap level, etc.). May be `NULL`. The following attribute values are assumed if you do not explicitly define them:

- `kCVOpenGLBufferTarget` = `GL_TEXTURE_RECTANGLE_EXT`
- `kCVOpenGLBufferInternalFormat` = `GL_RGBA`
- `kCVOpenGLBufferMaximumMipmapLevel` = 0

`bufferOut`

On output, `bufferOut` points to the newly created OpenGL buffer.

## Return Value

A Core Video result code. See [Core Video Constants](/documentation/CoreVideo/core-video-constants) for possible values.

## Discussion

---

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)