glshader

OpenGL fragment shader filter

Examples

 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.

 #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 );
 }

Hierarchy

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

Factory details

Authors:

Classification:Filter/Effect

Rank – none

Plugin – opengl

Package – GStreamer Base Plug-ins

Pad Templates

sink

video/x-raw(ANY):
         format: RGBA
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]
 texture-target: 2D

video/x-raw(memory:GLMemory):
         format: RGBA
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]
 texture-target: 2D

Presencealways

Directionsink

Object typeGstPad


src

video/x-raw(memory:GLMemory):
         format: RGBA
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]
 texture-target: 2D

video/x-raw(ANY):
         format: RGBA
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]
 texture-target: 2D

Presencealways

Directionsrc

Object typeGstPad


Signals

create-shader

GstGLShader *
create_shader_callback (GstElement * param_0,
                        gpointer udata)
def create_shader_callback (param_0, udata):
    #python callback for the 'create-shader' signal
function create_shader_callback(param_0: GstElement * param_0, udata: gpointer udata): {
    // javascript callback for the 'create-shader' signal
}

Parameters:

param_0
No description available
udata
No description available
Returns (GstGLShader *)
No description available

Flags: Run Last


Properties

fragment

“fragment” gchararray

GLSL fragment source

Flags : Read / Write

Default value : NULL


shader

“shader” GstGLShader *

GstGLShader to use

Flags : Read / Write


uniforms

“uniforms” GstStructure *

GLSL Uniforms

Flags : Read / Write


update-shader

“update-shader” gboolean

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

Flags : Read / Write

Default value : false


vertex

“vertex” gchararray

GLSL vertex source

Flags : Read / Write

Default value : NULL


The results of the search are