Update GLSL uniforms (glshader element)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Update GLSL uniforms (glshader element)

GStreamer-devel mailing list
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?

Thanks.

Regards,

Yu

  

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Update GLSL uniforms (glshader element)

GStreamer-devel mailing list
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.

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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

OpenPGP_signature (505 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Update GLSL uniforms (glshader element)

GStreamer-devel mailing list
Thanks Matt

Yes, I am sure I have Graphene compiled to the gst-plugin-base.

The question is how to create a GObject.Value with "Graphene.Vec2"? The sample code is shown in Python. I simply could not find any document about how to assign a "Graphene.Vec2" object as the GObject.Value to the Gst.Structure. Should I define the value as a boxed one? 

Thanks.

BRs,

Yu



On Thu, 6 May 2021 at 16:18, Matthew Waters <[hidden email]> wrote:
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.

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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel