CVOpenGLBuffer Reference

Derived from
Framework
System/Library/Frameworks/QuartzCore.framework
Companion guide
Declared in
CVOpenGLBuffer.h

Overview

To manipulate OpenGL buffers in Core Video, you use a Core Video OpenGL buffer. This buffer serves as a wrapper around the standard OpenGL buffer type (pbuffer) and allows you to store an image in video memory.

Functions

CVOpenGLBufferAttach

Attaches an OpenGL context to a Core Video OpenGL buffer.

CVReturn CVOpenGLBufferAttach (
   CVOpenGLBufferRef openGLBuffer,
   CGLContextObj cglContext,
   GLenum face,
   GLint level,
   GLint screen
);
Parameters
openGLBuffer

The buffer you want to attach an OpenGL context to.

cglContext

The OpenGL context you want to attach.

face

The OpenGL face enumeration (0 for non-cube maps.)

level

The mipmap level for drawing in the OpenGL context. This value cannot exceed the maximum mipmap level for this buffer.

screen

The virtual screen number you want to use for this context.

Return Value

A Core Video result code. See Core Video Constants Reference for possible values.

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

CVOpenGLBufferCreate

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

CVReturn CVOpenGLBufferCreate (
   CFAllocatorRef allocator,
   size_t width,
   size_t height,
   CFDictionaryRef attributes,
   CVOpenGLBufferRef *bufferOut
);
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 Reference for possible values.

Discussion

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

CVOpenGLBufferGetAttributes

Obtains the attributes of a Core Video OpenGL buffer.

CFDictionaryRef CVOpenGLBufferGetAttributes (
   CVOpenGLBufferRef openGLBuffer
);
Parameters
openGLBuffer

The OpenGL buffer whose attributes you want to obtain.

Return Value

A Core Foundation dictionary containing the OpenGL buffer attributes, or NULL if no attributes exist.

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

CVOpenGLBufferGetTypeID

Obtains the Core Foundation type ID for the OpenGL buffer type.

CFTypeID CVOpenGLBufferGetTypeID (
   void
);
Return Value

The Core Foundation ID for this data type.

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

CVOpenGLBufferRelease

Releases a Core Video OpenGL buffer.

void CVOpenGLBufferRelease (
   CVOpenGLBufferRef buffer
);
Parameters
buffer

The OpenGL buffer that you want to release.

Discussion

This function is equivalent to CFRelease, but is NULL safe.

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

CVOpenGLBufferRetain

Retains a Core Video OpenGL buffer.

CVOpenGLBufferRef CVOpenGLBufferRetain (
   CVOpenGLBufferRef buffer
);
Parameters
buffer

The OpenGL Buffer that you want to retain.

Return Value

For convenience, the OpenGL buffer that was retained.

Discussion

This function is equivalent to CFRetain, but is NULL safe.

Availability
  • Available in OS X v10.4 and later.
Declared In
CVOpenGLBuffer.h

Data Types

CVOpenGLBufferRef

A reference to a Core Video OpenGL buffer object.

typedef CVImageBufferRef CVOpenGLBufferRef;
Discussion

The Core Video OpenGL buffer is a wrapper around the standard OpenGL pbuffer.

Availability
  • Available in OS X v10.3 and later.
Declared In
CVOpenGLBuffer.h

Constants

OpenGL Buffer Attribute Keys

The attributes of an OpenGL buffer.

const CFStringRef kCVOpenGLBufferWidth;
const CFStringRef kCVOpenGLBufferHeight;
const CFStringRef kCVOpenGLBufferTarget;
const CFStringRef kCVOpenGLBufferInternalFormat;
const CFStringRef kCVOpenGLBufferMaximumMipmapLevel;
Constants
kCVOpenGLBufferWidth

The width of the buffer.

Available in OS X v10.4 and later.

Declared in CVOpenGLBuffer.h.

kCVOpenGLBufferHeight

The height of the buffer.

Available in OS X v10.4 and later.

Declared in CVOpenGLBuffer.h.

kCVOpenGLBufferTarget

The OpenGL target for this buffer.

Available in OS X v10.4 and later.

Declared in CVOpenGLBuffer.h.

kCVOpenGLBufferInternalFormat

The OpenGL internal format of this buffer.

Available in OS X v10.4 and later.

Declared in CVOpenGLBuffer.h.

kCVOpenGLBufferMaximumMipmapLevel

The maximum mipmap level for this buffer.

Available in OS X v10.4 and later.

Declared in CVOpenGLBuffer.h.