Mac Developer Library

Developer

System Framework Reference CVOpenGLBuffer Reference

Options
Deployment Target:

On This Page
Language:

CVOpenGLBuffer Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreVideo

Objective-C

@import CoreVideo;

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

  • Attaches an OpenGL context to a Core Video OpenGL buffer.

    Declaration

    Swift

    func CVOpenGLBufferAttach(_ openGLBuffer: CVOpenGLBuffer!, _ cglContext: CGLContextObj, _ face: GLenum, _ level: GLint, _ screen: GLint) -> CVReturn

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

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

    Objective-C

    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

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in OS X v10.4 and later.

  • Obtains the attributes of a Core Video OpenGL buffer.

    Declaration

    Swift

    func CVOpenGLBufferGetAttributes(_ openGLBuffer: CVOpenGLBuffer!) -> Unmanaged<CFDictionary>!

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    func CVOpenGLBufferGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CVOpenGLBufferGetTypeID ( void );

    Return Value

    The Core Foundation ID for this data type.

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in OS X v10.4 and later.

  • Releases a Core Video OpenGL buffer.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Availability

    Available in OS X v10.4 and later.

  • Retains a Core Video OpenGL buffer.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import CoreVideo;

    Availability

    Available in OS X v10.4 and later.

Data Types

  • A reference to a Core Video OpenGL buffer object.

    Declaration

    Swift

    typealias CVOpenGLBufferRef = CVOpenGLBuffer

    Objective-C

    typedef CVImageBufferRef CVOpenGLBufferRef;

    Discussion

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

    Import Statement

    Objective-C

    @import CoreVideo;

    Swift

    import CoreVideo

    Availability

    Available in OS X v10.3 and later.

Constants

  • The attributes of an OpenGL buffer.

    Declaration

    Swift

    let kCVOpenGLBufferWidth: CFString! let kCVOpenGLBufferHeight: CFString! let kCVOpenGLBufferTarget: CFString! let kCVOpenGLBufferInternalFormat: CFString! let kCVOpenGLBufferMaximumMipmapLevel: CFString!

    Objective-C

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

    Constants

    • kCVOpenGLBufferWidth

      kCVOpenGLBufferWidth

      The width of the buffer.

      Available in OS X v10.4 and later.

    • kCVOpenGLBufferHeight

      kCVOpenGLBufferHeight

      The height of the buffer.

      Available in OS X v10.4 and later.

    • kCVOpenGLBufferTarget

      kCVOpenGLBufferTarget

      The OpenGL target for this buffer.

      Available in OS X v10.4 and later.

    • kCVOpenGLBufferInternalFormat

      kCVOpenGLBufferInternalFormat

      The OpenGL internal format of this buffer.

      Available in OS X v10.4 and later.

    • kCVOpenGLBufferMaximumMipmapLevel

      kCVOpenGLBufferMaximumMipmapLevel

      The maximum mipmap level for this buffer.

      Available in OS X v10.4 and later.