Hi Roberto,

For sharing state like texture's all you need to do is share the
osg::StateSet that holds that state.  In you case I would probably
manually create the scene graph and then assign the callbacks and
share the appropriate objects I want. I wouldn't use clone at all, as
you can just share the Nodes, Geometry, StateSet and Texture directly
by reusing the same pointers.

As for the callbacks updating texture coordinates, it might be that
you could dynamically compute the updates down on the GPU or use a
TexMat state attribute to modifying the tex coords.  As I know nothing
about what you are trying to do with the tex coords and the effect you
are after I really can't be specific in my recommendations.

Robert.

On Wed, Feb 16, 2011 at 11:55 AM, Roberto Garrido
<robertogarridomar...@gmail.com> wrote:
> Hi,
>
> I'm newbie to OpenSceneGraph and I'm developing an application which supports 
> 2D animations over quads. The idea is apply a texture over each quad, and 
> update its texture coordinate array, using a cull callback.
>
> MatrixTransform -> Billboard(CullCallbakc) -> DrawableQuad(texture)
>
> Since I want to animate a lot of quads (100?) with the same texture, I would 
> like to share these textures, so that I have in video memory as less textures 
> as possible.
> For this reason, I'm using the clone method on the root node of each object, 
> but I don't think I'm having the results I am looking for, because the 
> consumed video memory is the same. I have tried with different Copy 
> Operations, but I have not found the appropriate one for sharing only 
> textures and drawables.
> What I really want is to share the texture, the drawable, and the billboard, 
> but NOT the cullcallback of the billboard, since the new object has to have 
> its own.
> Which would be the best approach for sharing drawables and textures?
> Should I use the clone method?
> Should I use the optimizer instead?
> Should I implement my own clone method?
> Maybe the clone method just duplicates nodes and doesnt' share anything?
>
> Thank you!
>
> Cheers,
> Roberto
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=36721#36721
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to