glshader: GStreamer Base Plugins 1.0 Plugins Reference Manual

## glshader glshader |

## Properties

gchar * | fragment | Read / Write
GstGLShader * | shader | Read / Write
GstStructure * | uniforms | Read / Write
gboolean | update-shader | Write
gchar * | vertex | Read / Write

## Signals

GstGLShader* | create-shader | Run Last

## Types and Values

struct | GstGLFilterShader

## Object Hierarchy

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

## Description

OpenGL fragment shader filter

#### Examples

    1
    gst-launch-1.0 videotestsrc ! glupload ! glshader fragment="\"`cat myshader.frag`\"" ! glimagesink

FBO (Frame Buffer Object) and GLSL (OpenGL Shading Language) are required. Depending on the exact OpenGL version chosen and the exact requirements of the OpenGL implementation, a version header may be required.

The following is a simple OpenGL ES (also usable with OpenGL 3 core contexts) passthrough shader with the required inputs.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    #version 100
    #ifdef GL_ES
    precision mediump float;
    #endif
    varying vec2 v_texcoord;
    uniform sampler2D tex;
    uniform float time;
    uniform float width;
    uniform float height;

    void main () {
      gl_FragColor = texture2D( tex, v_texcoord );
    }

## Synopsis

### Element Information

plugin | opengl
author | <matthew@centricular.com>
class | Filter/Effect

### Element Pads

name | sink
direction | sink
presence | always
details | video/x-raw(ANY), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D
| video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D

name | src
direction | source
presence | always
details | video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D
| video/x-raw(ANY), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D

## Functions

## Types and Values

### struct GstGLFilterShader

    struct GstGLFilterShader;

## Property Details

### The `“fragment”` property

      “fragment”                 gchar *

GLSL fragment source.

Owner: GstGLFilterShader

Flags: Read / Write

Default value: NULL

### The `“shader”` property

      “shader”                   GstGLShader *

GstGLShader to use.

Owner: GstGLFilterShader

Flags: Read / Write

### The `“uniforms”` property

      “uniforms”                 GstStructure *

GLSL Uniforms.

Owner: GstGLFilterShader

Flags: Read / Write

### The `“update-shader”` property

      “update-shader”            gboolean

Emit the 'create-shader' signal for the next frame.

Owner: GstGLFilterShader

Flags: Write

Default value: FALSE

### The `“vertex”` property

      “vertex”                   gchar *

GLSL vertex source.

Owner: GstGLFilterShader

Flags: Read / Write

Default value: NULL

## Signal Details

### The `“create-shader”` signal

    GstGLShader*
    user_function (GstGLFilterShader *gstglfiltershader,
                   gpointer           user_data)

Flags: Run Last