Re: Question about ClutterContent



Hi;

On 7 February 2016 at 20:31, Unknown <ctthaler gmail com> wrote:

I'm trying to develop a program using clutter but I'm running into trouble.
I can define ClutterContent, set it into a clutter stage (gtk embedded) and that
works so far.

ClutterContent *frame;

frame = clutter_image_new ();
pixbuf = gdk_pixbuf_new_from_file (" ...

clutter_image_set_data (CLUTTER_IMAGE (frame), ... (pixbuf)

But if I want to change the image data in a different thread (g_thread_new) the
function (clutter_image_set_data) throws an error. I' cannot even define a new
frame.
Why is that so?

Because you cannot use Clutter (or GTK) API from different threads
than the one that initialized Clutter and started the main loop.

If you want to load image data from disk (or from another source)
using a thread you will have to use a function like
g_main_context_invoke() or clutter_threads_add_idle() (they are pretty
much equivalent) at the end of the loading thread.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[ ] ebassi [ gmail com]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]