Update GLSL uniforms (glshader element)

Matthew Waters ystreet00 at gmail.com
Thu May 6 13:18:19 UTC 2021


Hi,

On 6/5/21 9:40 pm, Yu You via gstreamer-devel wrote:
> Hi,
>
> There's a way to modify uniform variables for the glshader element.
> The following is an example of changing simple value types like float.
>
>
>     uniforms = Gst.Structure.new_empty("uniforms")
>     u1 = GObject.Value(GObject.TYPE_FLOAT)
>     u1.set_float(hdegree)
>     uniforms.set_value("u1", u1)
>     shader.set_property("uniforms", uniforms)
>     uniforms.free()
>
> But it is common in GLSL shader we use data types like Vec2/Vec3.
> The following code did not work.
>     v1 = Graphene.Vec2()
>     v1.init(0.5,0.5)
>     uniforms.set_value("v1", v1)
>
> Should I create GObject.Value() with GObject.TYPE_?? for Graphene.Vec2?
> How to set the  Graphene.Vec2 object to the GObject.Value?

This may depend on if your GStreamer GL set up was built with graphene 
enabled at compile time

The code is definitely there for this: 
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/ext/gl/gstglfiltershader.c#L365 
<https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/ext/gl/gstglfiltershader.c#L365>.

Setting GST_DEBUG=3 in the environment will get you the GST_FIXME below 
if the glshader element doesn't understand the GValue's type.

Cheers
-Matt

>
> Thanks.
>
> Regards,
>
> Yu
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210506/8dde2701/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210506/8dde2701/attachment.sig>


More information about the gstreamer-devel mailing list