AW: Dynamic change of glshader element
Matthew Waters
ystreet00 at gmail.com
Wed Nov 19 01:45:02 PST 2014
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?id6619
>
> 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
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141119/dbec5902/attachment.sig>
More information about the gstreamer-devel
mailing list