Re: [osg-users] Modifying scene graph in event handler is safe, right?

2009-01-21 Thread Morné Pistorius
Thanks for the clarification, Robert!  My viewers are running in
SingleThreaded mode, so I should be OK, but it is definitely something
to keep in mind.

Cheers,
Morne


On Wed, Jan 21, 2009 at 1:01 PM, Robert Osfield
 wrote:
> Hi Morne,
>
> You can modify the scene graph in the event traversal, just like you
> can with the update traversal.  The only thing you need to be careful
> about is that if you are modifying StateSet (and its contents) and
> Drawables and their a rendering threads that are using these still
> running - this only happens for the DrawThreadPerContext and
> CullThreadPerCameraDrawThreadPerContext threading models.  The way to
> avoid the main thread doing the updates and the rendering thread(s)
> for overlapping is to make the StateSet and Drawable with a
> DataVariance of DYNAMIC.
>
> Robert.
>
> On Wed, Jan 21, 2009 at 12:41 PM, Morné Pistorius
>  wrote:
>> Hi all,
>>
>> I used to work under the rule of thumb to only ever modify my scene
>> using update callbacks, but scanning the lists I found reference
>> saying that modification anywhere outside the viewer.RenderTraversal()
>> is safe.  I just want to verify this: directly modifying my scene
>> graph in an eventhandler should be safe, right? And this should still
>> be safe if my scene is shared between multiple views (as in a
>> composite viewer), but not if my scene is shared between more than one
>> viewer window (assuming my viewers are created with a QGLWidget,
>> instead of a QWidget in which case it will be safe again).  I call
>> viewer.frame() on a QTimer evnet as in the OSG QtViewer examples.
>>
>> Have I got that right?
>>
>> Thanks!
>>
>> Morne
>> ___
>> 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
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Modifying scene graph in event handler is safe, right?

2009-01-21 Thread Robert Osfield
Hi Morne,

You can modify the scene graph in the event traversal, just like you
can with the update traversal.  The only thing you need to be careful
about is that if you are modifying StateSet (and its contents) and
Drawables and their a rendering threads that are using these still
running - this only happens for the DrawThreadPerContext and
CullThreadPerCameraDrawThreadPerContext threading models.  The way to
avoid the main thread doing the updates and the rendering thread(s)
for overlapping is to make the StateSet and Drawable with a
DataVariance of DYNAMIC.

Robert.

On Wed, Jan 21, 2009 at 12:41 PM, Morné Pistorius
 wrote:
> Hi all,
>
> I used to work under the rule of thumb to only ever modify my scene
> using update callbacks, but scanning the lists I found reference
> saying that modification anywhere outside the viewer.RenderTraversal()
> is safe.  I just want to verify this: directly modifying my scene
> graph in an eventhandler should be safe, right? And this should still
> be safe if my scene is shared between multiple views (as in a
> composite viewer), but not if my scene is shared between more than one
> viewer window (assuming my viewers are created with a QGLWidget,
> instead of a QWidget in which case it will be safe again).  I call
> viewer.frame() on a QTimer evnet as in the OSG QtViewer examples.
>
> Have I got that right?
>
> Thanks!
>
> Morne
> ___
> 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


[osg-users] Modifying scene graph in event handler is safe, right?

2009-01-21 Thread Morné Pistorius
Hi all,

I used to work under the rule of thumb to only ever modify my scene
using update callbacks, but scanning the lists I found reference
saying that modification anywhere outside the viewer.RenderTraversal()
is safe.  I just want to verify this: directly modifying my scene
graph in an eventhandler should be safe, right? And this should still
be safe if my scene is shared between multiple views (as in a
composite viewer), but not if my scene is shared between more than one
viewer window (assuming my viewers are created with a QGLWidget,
instead of a QWidget in which case it will be safe again).  I call
viewer.frame() on a QTimer evnet as in the OSG QtViewer examples.

Have I got that right?

Thanks!

Morne
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org