## GstGLBuffer

GstGLBuffer — memory subclass for GL buffers

## Functions

void | gst_gl_buffer_init_once ()
gboolean | gst_is_gl_buffer ()
GstGLBuffer * | gst_gl_buffer_alloc ()
GstGLBufferAllocationParams * | gst_gl_buffer_allocation_params_new ()

## Types and Values

| GstGLBuffer
struct | GstGLBufferAllocationParams
#define | GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER
| GstGLBufferAllocator
| GstGLBufferAllocatorClass
#define | GST_GL_BUFFER_ALLOCATOR_NAME
#define | GST_CAPS_FEATURE_MEMORY_GL_BUFFER

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstAllocator
                    ╰── GstGLBaseMemoryAllocator
                        ╰── GstGLBufferAllocator

## Description

GstGLBuffer is a GstMemory subclass providing support for the mapping of GL buffers.

Data is uploaded or downloaded from the GPU as is necessary.

## Functions

### gst_gl_buffer_init_once ()

    void
    gst_gl_buffer_init_once (void);

Initializes the GL Buffer allocator. It is safe to call this function multiple times. This must be called before any other GstGLBuffer operation.

Since: 1.8

### gst_is_gl_buffer ()

    gboolean
    gst_is_gl_buffer (GstMemory *mem);

#### Parameters

mem | a GstMemory |

#### Returns

whether the memory at `mem` is a GstGLBuffer

Since: 1.8

### gst_gl_buffer_alloc ()

    GstGLBuffer *
    gst_gl_buffer_alloc (GstGLContext *context,
                         guint gl_target,
                         guint gl_usage,
                         GstAllocationParams *params,
                         gsize maxsize);

### gst_gl_buffer_allocation_params_new ()

    GstGLBufferAllocationParams *
    gst_gl_buffer_allocation_params_new (GstGLContext *context,
                                         gsize alloc_size,
                                         GstAllocationParams *alloc_params,
                                         guint gl_target,
                                         guint gl_usage);

#### Parameters

context | a GstGLContext |
alloc_size | the size in bytes to allocate |
alloc_params | the GstAllocationParams for `tex_id` . | [allow-none]
gl_target | the OpenGL target to allocate |
gl_usage | the OpenGL usage hint to allocate with |

#### Returns

a new GstGLBufferAllocationParams for allocating OpenGL buffer objects

Since: 1.8

## Types and Values

### GstGLBuffer

    typedef struct {
      GstGLBaseMemory       mem;

      guint                 id;
      guint                 target;         /* XXX: put this in the allocator? */
      guint                 usage_hints;     /* XXX: put this in the allocator? */
    } GstGLBuffer;

Represents information about a GL buffer

#### Members

GstGLBaseMemory `mem`; | the parent object |
guint `id`; | the buffer id for this memory |
guint `target`; | the OpenGL target of this texture for binding purposes |
guint `usage_hints`; | the OpenGL usage hints this buffer was created with |

### struct GstGLBufferAllocationParams

    struct GstGLBufferAllocationParams {
      GstGLAllocationParams     parent;

      guint                     gl_target;
      guint                     gl_usage;
    };

#### Members

GstGLAllocationParams `parent`; | parent object |
guint `gl_target`; | the OpenGL target to bind the buffer to |
guint `gl_usage`; | the OpenGL usage hint to create the buffer with |

### GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER

    #define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER (1 << 4)

### GstGLBufferAllocator

    typedef struct _GstGLBufferAllocator GstGLBufferAllocator;

Opaque GstGLAllocator struct

### GstGLBufferAllocatorClass

    typedef struct {
      GstGLBaseMemoryAllocatorClass parent_class;
    } GstGLBufferAllocatorClass;

The GstGLBufferAllocatorClass only contains private data

### GST_GL_BUFFER_ALLOCATOR_NAME

    #define GST_GL_BUFFER_ALLOCATOR_NAME   "GLBuffer"

The name of the GL buffer allocator

### GST_CAPS_FEATURE_MEMORY_GL_BUFFER

    #define GST_CAPS_FEATURE_MEMORY_GL_BUFFER "memory:GLBuffer"

## See Also

GstMemory, GstAllocator