2009/4/23 Emmanuele Bassi <[email protected]>

> On Thu, 2009-04-23 at 00:00 +0200, Julien Isorce wrote:
>
> > Is there a way to be sure that a stage is not used (from clutter side)
> >  just during a function.
>
> > For example:
> >
> > void do_some_stuff (ClutterStage *s)
> > {
> >   clutter_enter_stage (s);
> >
> >   //here I want to be sure that the stage s and its attached actors
> > are not used, not drawn, not repaint.. :nothing from clutter
> >
> >   clutter_leave_stage (s)
> > }
> >
> > AND do_some_stuff is called in the main thread, the one where clutter
> > is initialized.
>
> Clutter is a single threaded library. if you are inside a function then
> nothing can be running at the same time.


ok.

Actually I want to update a ClutterTexture with a texture that comes from my
own opengl context that is created in an other thread than the clutter one.
Just after creating my opengl context, I call wglSharelists or I call
myopenglcontext = GLXCreateContext (....,  clutter_gl_context..)
And this call is ok. (it does not fail).

When I have a texture from my opengl context is ready, then I call
clutter_threads_add_idle and in the callback I call create a cogl texture
from foreign.
Then I update  the clutter texture using clutter_texture_set_cogl_texture.

If I am right, when the cogl texture is created from foreign then the old
cogl texture is not deleted (I mean no glDeleteTexture is called, but cogl
handle is unref) when doing clutter_texture_set_cogl_texture.

It almost works. I can see my textures that comes from my opengl context,
inside a clutter effect.
But sometimes the program just stop like a dead lock and I am trying to
figure out what it's going on.
(It's ok if I update the clutter texture just few times)

A point I saw is that in clutter_texture_set_cogl_texture a queue_redraw is
done. So how can I be sure that the cogl texture is drawn ? I mean when can
I delete my texture that comes from my opengl context ?

Does someone already tried a such case ? Any idea about the best way to
update a clutter texture with a foreign opengl texture ?
Frame buffer object is used inside the clutter texture ? (I can see some
offscreen word in clutter texture source code)

(an other information is that my source texture has not the same framerate
than the clutter one)


>
>
> on top of that, Clutter API should never be used from multiple threads
> without acquiring the thread lock.
>
> > I am almost sure that clutter_threads_enter/leave is not that I want.
>

Ok now I use
clutter_threads_init ();
clutter_init (&argc, &argv);
 clutter_threads_enter ();

to be sure that clutter_threads_add_idle is using the clutter lock.


>
> then you're almost surely wrong.
>
> ciao,
>  Emmanuele.


Sincerely

Julien


>
>
> --
> Emmanuele Bassi, Senior Engineer        | [email protected]
> Intel Open Source Technology Center     | http://oss.intel.com
>
> --
> To unsubscribe send a mail to 
> [email protected]<clutter%[email protected]>
>
>

Reply via email to