## GstGLFilter

GstGLFilter — GstBaseTransform subclass for dealing with RGBA textures

## Functions

gboolean | ( *GstGLFilterRenderFunc ) ()
gboolean | gst_gl_filter_render_to_target ()
void | gst_gl_filter_render_to_target_with_shader ()
gboolean | gst_gl_filter_filter_texture ()
void | gst_gl_filter_draw_fullscreen_quad ()
void | gst_gl_filter_add_rgba_pad_templates ()

## Types and Values

| GstGLFilter
| GstGLFilterClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseTransform
                        ╰── GstGLBaseFilter
                            ╰── GstGLFilter

## Includes

    #include <gst/gl/gl.h>

## Description

GstGLFilter helps to implement simple OpenGL filter elements taking a single input and producing a single output with a GstGLFramebuffer

## Functions

### GstGLFilterRenderFunc ()

    gboolean
    (*GstGLFilterRenderFunc) (GstGLFilter *filter,
                              GstGLMemory *in_tex,
                              gpointer user_data);

#### Parameters

filter | the GstGLFilter |
in_tex | the input GstGLMemory to render |
user_data | user data |

#### Returns

whether the render succeeded

Since: 1.10

### gst_gl_filter_render_to_target ()

    gboolean
    gst_gl_filter_render_to_target (GstGLFilter *filter,
                                    GstGLMemory *input,
                                    GstGLMemory *output,
                                    GstGLFilterRenderFunc func,
                                    gpointer data);

Transforms `input` into `output` using `func` on through FBO.

#### Parameters

filter | a GstGLFilter |
input | the input texture |
output | the output texture |
func | the function to transform `input` into `output` . called with `data` . | [scope call]
data | the data associated with `func` . | [allow-none]

#### Returns

the return value of `func`

Since: 1.10

### gst_gl_filter_render_to_target_with_shader ()

    void
    gst_gl_filter_render_to_target_with_shader
                                   (GstGLFilter *filter,
                                    GstGLMemory *input,
                                    GstGLMemory *output,
                                    GstGLShader *shader);

Transforms `input` into `output` using `shader` with a FBO.

See also: `gst_gl_filter_render_to_target()`

#### Parameters

filter | a GstGLFilter |
input | the input texture |
output | the output texture |
shader | the shader to use. |

Since: 1.4

### gst_gl_filter_filter_texture ()

    gboolean
    gst_gl_filter_filter_texture (GstGLFilter *filter,
                                  GstBuffer *inbuf,
                                  GstBuffer *outbuf);

Calls filter_texture vfunc with correctly mapped GstGLMemorys

#### Parameters

filter | a GstGLFilter |
inbuf | an input buffer |
outbuf | an output buffer |

#### Returns

whether the transformation succeeded

Since: 1.4

### gst_gl_filter_draw_fullscreen_quad ()

    void
    gst_gl_filter_draw_fullscreen_quad (GstGLFilter *filter);

Render a fullscreen quad using the current GL state. The only GL state this modifies is the necessary vertex/index buffers and, if necessary, a Vertex Array Object for drawing a fullscreen quad. Framebuffer state, any shaders, viewport state, etc must be setup by the caller.

#### Parameters

filter | a GstGLFilter |

Since: 1.10

### gst_gl_filter_add_rgba_pad_templates ()

    void
    gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass *klass);

## Types and Values

### GstGLFilter

    typedef struct {
      GstVideoInfo       in_info;
      GstVideoInfo       out_info;
      GstGLTextureTarget in_texture_target;
      GstGLTextureTarget out_texture_target;

      GstCaps           *out_caps;

      /* protected */
      GstGLFramebuffer  *fbo;
    } GstGLFilter;

#### Members

GstVideoInfo `in_info`; | the video info for input buffers |
GstVideoInfo `out_info`; | the video info for output buffers |
GstGLTextureTarget `in_texture_target`; | The texture target of the input buffers (usually 2D) |
GstGLTextureTarget `out_texture_target`; | The texture target of the output buffers (usually 2D) |
GstCaps *`out_caps`; | the output GstCaps |
GstGLFramebuffer *`fbo`; | GstGLFramebuffer object used for transformations (only for subclass usage) |

### GstGLFilterClass

    typedef struct {
      GstGLBaseFilterClass parent_class;

      gboolean (*set_caps)          (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
      gboolean (*filter)            (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
      gboolean (*filter_texture)    (GstGLFilter *filter, GstGLMemory *in_tex, GstGLMemory *out_tex);
      gboolean (*init_fbo)          (GstGLFilter *filter);

      GstCaps *(*transform_internal_caps) (GstGLFilter *filter,
        GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps);
    } GstGLFilterClass;

#### Members

`set_caps` () | mirror from GstBaseTransform |
`filter` () | perform operations on the input and output buffers. In general, you should avoid using this method if at all possible. One valid use-case for using this is keeping previous buffers for future calculations. Note: If `filter` exists, then `filter_texture` is not run |
`filter_texture` () | given `in_tex` , transform it into `out_tex` . Not used if `filter` exists |
`init_fbo` () | perform initialization when the Framebuffer object is created |
`transform_internal_caps` () | Perform sub-class specific modifications of the caps to be processed between upload on input and before download for output. |

## See Also

GstBaseTransform, GstGLContext, GstGLFramebuffer