## GstGLFormat

GstGLFormat — utilities for dealing with OpenGL formats

## Functions

gboolean | gst_gl_format_is_supported ()
guint | gst_gl_format_type_n_bytes ()
GstGLFormat | gst_gl_format_from_video_info ()
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 ()
void | gst_gl_format_type_from_sized_gl_format ()

## 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
enum | GstGLFormat

## Includes

    #include <gst/gl/gl.h>

## Description

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

## Functions

### gst_gl_format_is_supported ()

    gboolean
    gst_gl_format_is_supported (GstGLContext *context,
                                GstGLFormat format);

#### Parameters

context | a GstGLContext |
format | the GstGLFormat to check is supported by `context` |

#### Returns

Whether `format` is supported by `context` based on the OpenGL API, version, or available OpenGL extension/s.

### 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_format_from_video_info ()

    GstGLFormat
    gst_gl_format_from_video_info (GstGLContext *context,
                                   GstVideoInfo *vinfo,
                                   guint plane);

#### Parameters

context | a GstGLContext |
vinfo | a GstVideoInfo |
plane | the plane number in `vinfo` |

#### Returns

the GstGLFormat necessary for holding the data in `plane` of `vinfo`

### 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`

### gst_gl_format_type_from_sized_gl_format ()

    void
    gst_gl_format_type_from_sized_gl_format
                                   (GstGLFormat format,
                                    GstGLFormat *unsized_format,
                                    guint *gl_type);

Get the unsized format and type from `format` for usage in glReadPixels, glTex{Sub}Image*, glTexImage* and similar functions.

#### Parameters

format | the sized internal GstGLFormat |
unsized_format | location for the resulting unsized GstGLFormat. | [out]
gl_type | location for the resulting GL type. | [out]

## 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_EXTERNAL_OES` as a GstBufferPool pool option

### enum GstGLFormat

#### Members

GST_GL_LUMINANCE | Single component replicated across R, G, and B textures components |
GST_GL_ALPHA | Single component stored in the A texture component |
GST_GL_LUMINANCE_ALPHA | Combination of GST_GL_LUMINANCE and GST_GL_ALPHA |
GST_GL_RED | Single component stored in the R texture component |
GST_GL_R8 | Single 8-bit component stored in the R texture component |
GST_GL_RG | Two components stored in the R and G texture components |
GST_GL_RG8 | Two 8-bit components stored in the R and G texture components |
GST_GL_RGB | Three components stored in the R, G, and B texture components |
GST_GL_RGB8 | Three 8-bit components stored in the R, G, and B texture components |
GST_GL_RGB565 | Three components of bit depth 5, 6 and 5 stored in the R, G, and B texture components respectively. |
GST_GL_RGB16 | Three 16-bit components stored in the R, G, and B texture components |
GST_GL_RGBA | Four components stored in the R, G, B, and A texture components respectively. |
GST_GL_RGBA8 | Four 8-bit components stored in the R, G, B, and A texture components respectively. |
GST_GL_RGBA16 | Four 16-bit components stored in the R, G, B, and A texture components respectively. |
GST_GL_DEPTH_COMPONENT16 | A single 16-bit component for depth information. |
GST_GL_DEPTH24_STENCIL8 | A 24-bit component for depth information and a 8-bit component for stencil informat. |

## See Also

GstGLBaseMemory, GstGLMemory, GstGLFramebuffer, GstGLBuffer