[osg-users] How safe is it to modify an node during cull traversal

Robert Osfield robert.osfield at gmail.com
Tue Oct 11 02:00:43 PDT 2016


Hi Lincoln,

How safe it is to modify the scene graph during the cull traversal
depends upon what you are doing, what threading model you are using
and how many graphics contexts your application will run.

If you are running single threaded then it'll be safe but if you have
multiple graphics contexts/Cameras you could end up with the end
points only being configured for one of the graphics contexts/Cameras
unless you have multi-buffered the data.

There is also another restriction on the safety side - don't
add/remove nodes as this can invalided iterators unless you are really
careful.

As a general rule it's safer not to modify the scene graph in cull -
it's the most flexible and safe way to mange the scene graph as you'll
be add multiple graphics context and cameras safely and run with
different threading models.

There are often ways of shifting dynamic operations in the cull
traversal to the GPU using shaders, I haven't ever tried it for an
infinite line but I'm sure there will be ways of doing it.

Robert.

On 11 October 2016 at 09:46, Lincoln Nxumalo <lincoln.nxumalo at gmail.com> wrote:
> Hi All,
>
> I'm trying to implement to an "infinite" line. The way I'm going about doing this is computing the intersection if the line with the view frutum and using those intersection points as the end points of the line rather than drawing a "very long" line.
>
> I want to use a node callback to update the end points of the line. However, I can't figure out a way to obtain the projection matrix in the update traversal so I can construct the view frutum planes. I can only do this in the cull traversal using the cull stack obtained from the node visitor.
>
> So long story short, maybe a bit too late for that, is it safe to update the position of the line in the cull traversal or will I run into issues sometimes?
>
> Thanks in advance.
> ...
>
> Thank you!
>
> Cheers,
> Lincoln
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68954#68954
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list