OpenGL Formats: GStreamer Bad Plugins 1.0 Library Reference Manual

## OpenGL Formats OpenGL Formats — utilities for dealing with OpenGL formats |

## Functions

guint | gst_gl_format_type_n_bytes ()
guint | gst_gl_texture_type_n_bytes ()
guint | gst_gl_format_from_gl_texture_type ()
GstVideoGLTextureType | gst_gl_texture_type_from_format ()
guint | gst_gl_sized_gl_format_from_gl_format_type ()
GstGLTextureTarget | gst_gl_texture_target_from_string ()
const gchar * | gst_gl_texture_target_to_string ()
guint | gst_gl_texture_target_to_gl ()
GstGLTextureTarget | gst_gl_texture_target_from_gl ()
const gchar * | gst_gl_texture_target_to_buffer_pool_option ()

## Types and Values

enum | GstGLTextureTarget
#define | GST_GL_TEXTURE_TARGET_2D_STR
#define | GST_GL_TEXTURE_TARGET_RECTANGLE_STR
#define | GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR
#define | GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D
#define | GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE
#define | GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES

## Description

Some useful utilities for converting between various formats and OpenGL formats.

## Functions

### gst_gl_format_type_n_bytes ()

    guint
    gst_gl_format_type_n_bytes (guint format,
                                guint type);

#### Parameters

format | the OpenGL format, `GL_RGBA`, `GL_LUMINANCE`, etc |
type | the OpenGL type, `GL_UNSIGNED_BYTE`, `GL_FLOAT`, etc |

#### Returns

the number of bytes the specified `format` , `type` combination takes per pixel

### gst_gl_texture_type_n_bytes ()

    guint
    gst_gl_texture_type_n_bytes (GstVideoGLTextureType tex_format);

#### Parameters

tex_format | a GstVideoGLTextureType |

#### Returns

the number of bytes `tex_format` used per pixel

### gst_gl_format_from_gl_texture_type ()

    guint
    gst_gl_format_from_gl_texture_type (GstVideoGLTextureType tex_format);

#### Parameters

tex_format | a GstVideoGLTextureType |

#### Returns

the OpenGL format specified by `tex_format`

### gst_gl_texture_type_from_format ()

    GstVideoGLTextureType
    gst_gl_texture_type_from_format (GstGLContext *context,
                                     GstVideoFormat v_format,
                                     guint plane);

#### Parameters

context | a GstGLContext |
v_format | a GstVideoFormat |
plane | the plane number (starting from 0) |

#### Returns

the GstVideoGLTextureType for the specified `format` and `plane` that can be allocated using `context`

### gst_gl_sized_gl_format_from_gl_format_type ()

    guint
    gst_gl_sized_gl_format_from_gl_format_type
                                   (GstGLContext *context,
                                    guint format,
                                    guint type);

#### Parameters

context | a GstGLContext |
format | an OpenGL format, `GL_RGBA`, `GL_LUMINANCE`, etc |
type | an OpenGL type, `GL_UNSIGNED_BYTE`, `GL_FLOAT`, etc |

#### Returns

the sized internal format specified by `format` and `type` that can be used in `context`

### gst_gl_texture_target_from_string ()

    GstGLTextureTarget
    gst_gl_texture_target_from_string (const gchar *str);

#### Parameters

str | a string equivalant to one of the GST_GL_TEXTURE_TARGET_*_STR values |

#### Returns

the GstGLTextureTarget represented by `str` or `GST_GL_TEXTURE_TARGET_NONE`

### gst_gl_texture_target_to_string ()

    const gchar *
    gst_gl_texture_target_to_string (GstGLTextureTarget target);

#### Parameters

target | a GstGLTextureTarget |

#### Returns

the stringified version of `target` or `NULL`

### gst_gl_texture_target_to_gl ()

    guint
    gst_gl_texture_target_to_gl (GstGLTextureTarget target);

#### Parameters

target | a GstGLTextureTarget |

#### Returns

the OpenGL value for binding the `target` with `glBindTexture()` and similar functions or 0

### gst_gl_texture_target_from_gl ()

    GstGLTextureTarget
    gst_gl_texture_target_from_gl (guint target);

#### Parameters

target | an OpenGL texture binding target |

#### Returns

the GstGLTextureTarget that's equiavalant to `target` or `GST_GL_TEXTURE_TARGET_NONE`

### gst_gl_texture_target_to_buffer_pool_option ()

    const gchar *
    gst_gl_texture_target_to_buffer_pool_option
                                   (GstGLTextureTarget target);

#### Parameters

target | a GstGLTextureTarget |

#### Returns

a string representing the `GstBufferPoolOption` specified by `target`

## Types and Values

### enum GstGLTextureTarget

#### Members

GST_GL_TEXTURE_TARGET_NONE | no texture target |
GST_GL_TEXTURE_TARGET_2D | 2D texture target |
GST_GL_TEXTURE_TARGET_RECTANGLE | rectangle texture target |
GST_GL_TEXTURE_TARGET_EXTERNAL_OES | external oes texture target |

Since: 1.8

### GST_GL_TEXTURE_TARGET_2D_STR

    #define GST_GL_TEXTURE_TARGET_2D_STR "2D"

String used for `GST_GL_TEXTURE_TARGET_2D` in things like caps values

### GST_GL_TEXTURE_TARGET_RECTANGLE_STR

    #define GST_GL_TEXTURE_TARGET_RECTANGLE_STR "rectangle"

String used for `GST_GL_TEXTURE_TARGET_RECTANGLE` in things like caps values

### GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR

    #define GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR "external-oes"

String used for `GST_GL_TEXTURE_TARGET_EXTERNAL_OES` in things like caps values

### GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D

    #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D "GstBufferPoolOptionGLTextureTarget2D"

String used for `GST_GL_TEXTURE_TARGET_2D` as a GstBufferPool pool option

### GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE

    #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE "GstBufferPoolOptionGLTextureTargetRectangle"

String used for `GST_GL_TEXTURE_TARGET_RECTANGLE` as a GstBufferPool pool option

### GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES

    #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES "GstBufferPoolOptionGLTextureTargetExternalOES"

String used for `GST_GL_TEXTURE_TARGET_ESTERNAL_OES` as a GstBufferPool pool option

## See Also

GstGLBaseMemory, GstGLMemory, GstGLFramebuffer, GstGLBuffer