Dynamic change of glshader element

Matthew Waters ystreet00 at gmail.com
Thu Sep 1 23:45:32 UTC 2016


On 01/09/16 22:52, Holger wrote:
> I created the pipeline in C because I thought there might be a problem with
> the python wrapper.
> But the program crashes at the same function call.
>
> // part of the pipeline
> elGlshader = gst_element_factory_make("glshader", "shader");
> g_object_set(G_OBJECT(elGlshader), "fragment", g_gcharShaderPrg, NULL);
> g_timeout_add_seconds (1, timeout_cb, elGlshader);
>
>
> // the pipeline is running as expected and crashes after the timer expires
> static gboolean timeout_cb (gpointer user_data)
> {
>    g_print("Timer\n");
>    GValue * value;
>    GstGLShader *pShader;
>    g_object_get_property(G_OBJECT(user_data),"shader", value);
>    pShader = g_value_get_pointer(value);
>    if (pShader != NULL)
>    {
>       gst_gl_shader_set_uniform_1f(pShader , "separation", -0.1); // Gives
> an exception violation 

In order to call gst_gl_shader_set_uniform* functions, you need to have
the shader in use (with gst_gl_shader_use()) and there be a GL context
active on the current thread.  This are standard OpenGL requirements and
GStreamer doesn't hide them from you.  If you don't have a GL context
readily available, the "create-shader" signal on glshader is executed
from a thread with a GL context and you can set the update-shader
property from any thread to have it signalled.  This way you can update
the shader/create a new shader in a thread with a GL context.

Cheers
-Matt

>    }
>    else
>    {
>       g_print("NO SHADER!!!\n");
>    }
>    return TRUE;
> }
>
> Calling gst_gl_shader.... causes a segmentation fault (as it does in
> python). Is my code wrong, did I forget to lock something or is it the same
> error described before???? I use the gst-1.8.3 on windows7.
>
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Dynamic-change-of-glshader-element-tp4669514p4679352.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 502 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160902/d93a2dc4/attachment.sig>


More information about the gstreamer-devel mailing list