AW: AW: Dynamic change of glshader element

Christian Winkler christian at heidelbergs.de
Sun Nov 23 04:04:33 PST 2014


Ok...after hours of trying to get uniforms working even in command line i have to come to a simple conclusion:
The setting of a preset file for a glshader element is broken in the windows version of gstreamer.
It works under android and ubuntu....

What a waste of time :-/

Thanks to all of you for your help.

Now lets go fort he c code...

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von Matthew Waters
Gesendet: Mittwoch, 19. November 2014 10:45
An: gstreamer-devel at lists.freedesktop.org
Betreff: Re: AW: Dynamic change of glshader element

On 19/11/14 08:18, Christian Winkler wrote:
> Dear Luc,
>
> thanks.
> I definitley have trouble setting the presets.
> Either by command line or code, they are not accepted.
>
> For instance:
> gst-launch-1.0.exe -e -v videotestsrc ! "video/x-raw, width80, 
> heightr0" ! videoconvert ! glshader location=dist.frag 
> preset=dist.preset ! glimagesink
>
>
> dist frag:
> precision mediump float;
> varying vec2 v_texcoord;
> uniform sampler2D tex;
>
> const vec4 kappa =ec4(2.75,1.7,0.5,0.5); const float screen_width 
> =920.0; const float screen_height =080.0; const vec2 leftCenter 
> =ec2(0.25, 0.4); const vec2 rightCenter =ec2(0.75, 0.4); const float 
> separation =0.025; const bool stereo_input =alse; uniform float 
> scaleFactor; .........
>
> dist.preset:
> float scaleFactor = float(0.2);
>
> or, also tried:
> float scaleFactor =.2;

The following works for me.  Note that you need the float on both sides of the assignment in the preset and they must be the same type.  Also, you could try running with the gst debug log and seeing what it outputs.

preset/vars:
float scale = float(0.2);

shader:
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float scale;

void main () {
  gl_FragColor = texture2D( tex, v_texcoord ) * vec4(vec3(scale), 1.0); }

> The value 0.2 is simply ignored.
> I dont know why that happens
>
> scaleFactor iss et to 0.
>
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel 
> [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von 
> luc.deschenaux
> Gesendet: Montag, 17. November 2014 04:45
> An: gstreamer-devel at lists.freedesktop.org
> Betreff: Re: Dynamic change of glshader element
>
> You could also initialize the uniform variables using text values 
> (using GLSL
> syntax) with something like
>         g_object_set (G_OBJECT (glshader), "preset", str, NULL)
>
> or change their value using text values with
>         g_object_set (G_OBJECT (glshader), "vars", str, NULL)
>
> See
> https://bug600195.bugzilla-attachments.gnome.org/attachment.cgi?id661
> 9
>
> But since this rely on the gst_gl_shader_set_uniform methods (with the overhead implied for parsing the text string), calling the gst_gl_shader_set_uniforms methods directly is more efficient for modifying values dynamically.
>
>
>
> --
> View this message in context: 
> http://gstreamer-devel.966125.n4.nabble.com/Dynamic-change-of-glshader
> -element-tp4669514p4669526.html Sent from the GStreamer-devel mailing 
> list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>





More information about the gstreamer-devel mailing list