On Sun, 2012-05-13 at 10:12 +1000, Amy C wrote:
> On Sat, May 12, 2012 at 4:31 PM, Amy C <mathematical.cof...@gmail.com> wrote:
> > Now, I could spawn each of the 50 toons by having each *individual*
> > toon store a copy of its filmstrip image. This seems easiest (each
> > toon is just a Clutter.Texture), but also seems inefficient.
> >
> > The way the original XPenguins does it and the way I'd like to try, is
> > to have some central ToonData object, one per type of toon. So in my
> > example I'll have 5 of them. Each ToonData has its image filmstrip
> > loaded up. Then, when an individual toon is drawn, it looks up the
> > ToonData corresponding to its type and picks out the frame of the
> > animation it is up to.
> >
> > In this way, I only need to have 5 image filmstrips loaded up in
> > memory, instead of one filmstrip per toon.
> >
> > My question is, how can I implement this situation?
> 
> I've had a longer think about this, and I feel the way to go is that
> there is one ToonData per type of toon, which is a Clutter.Texture.
> 
> Then each *individual* toon is a Clutter.Clone, cloning the ToonData
> (Clutter.Texture) corresponding to its type - so any skateboarder toon
> is just a Clutter.Clone of the Skateboarder Clutter.Texture.
> 
> Looking through the documentation I see mentions of a
> Clutter.CloneTexture which is exactly what i want -- it says that this
> makes a clone of a Clutter.Texture but points to the same underlying
> texture resource.
> 
> However looking through the 1.10 documentation
> (http://developer.gnome.org/clutter/1.10) it seems there is no
> Clutter.CloneTexture any more, but a Clutter.Clone. My question is, is
> this the same thing? If I Clutter.Clone a Clutter.Texture will it load
> the texture again for each Clone or just store it once (in the
> original CloneTexture) and refer back to it?


Clutter.CloneTexture doesn't exist in Clutter, and unless it's something
from Clutter < 1.0, I don't think it ever existed. This must be
something specific to the binding you're using.

If you want to avoid loading the texture more than once, you can do that
by using Cogl at first to create a Cogl texture, then create a bunch of
empty ClutterTexture and set the Cogl texture on each of the
ClutterTexture. This way the Cogl texture is shared amongst the actors
you've created.

Hope that answers your question.

--
Lionel

_______________________________________________
clutter-app-devel-list mailing list
clutter-app-devel-list@clutter-project.org
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to