Hi Guy,

This is how I'd do it.  First up you can't multiple buffer UserData
directly, so to do the multi-buffer you'll need to create your own
multibuffer UserData class subclassed from osg::Referenced.  Second to
decide between the two buffers you can use the current osg::RenderInfo
that is passed into the drawImplementation(RenderInfo&) to find out
the current view/camera.

Robert.

On Sat, May 30, 2009 at 1:55 AM, Guy Volckaert
<[email protected]> wrote:
> Hi,
>
> What's the best way to pass user data to all nodes and drawables. For 
> example, lets assumes I have 2 cameras (left & right). Each camera points to 
> the same scene. When rendering the left camera, I want the the nodes and 
> drawables to use userdata1, and when rendering the right camera I want the 
> nodes and drawables to use userdata2.
>
> The goal is to pass thread safe data during the rendering of each camera 
> without having to use a mutext or a critical section to access the data. 
> Since each camera has its own user data "copy" it should be thread safe.
>
> I know that the RenderInfo contains a userdata ptr, but I don't know how to 
> use it as decribed above.
>
> Any suggestions are appreciated.
>
> Thank you!
>
> Cheers,
> Guy
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=13202#13202
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to