[osg-users] Insight into osg::Operation

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Sat Jun 6 12:06:53 PDT 2015


Okay, sorry for the noise.
My problem was a optimizer-run right after the scene was loaded, which 
of course might collapse groups.
Any thoughts on how to optimize in the background anyways?

Cheers
Sebastian
> I found out, that the crash occurs when a osg:Group is traversed by 
> the intersection visitor.
> This is akward.. is the rendering thread somehow modifying children of 
> the scene?
>
> cheers
> Sebastian
>> Hi,
>>
>> I need some help with the osg::Operation.
>> What I'm trying to achieve seems relatively simple. After loading a 
>> model, I want some background operation to visit with an 
>> intersections visitor.
>> Pseudo code:
>> Load Node
>> Create osg::Operation-derived ref_ptr and do
>>     mThreadedOperations->add(operation);
>>     viewer->addUpdateOperation(operation);
>> during runtime (e.g. before viewer.frame())
>>
>> Unfortunately I'm experiencing crashes (vector iterator not 
>> dereferenceable etc) in the intersection visitor ( to be more exact: 
>> in the node->accept(*mIntersectionVisitor))
>> It works flawlessly if I let the body of the operation execute 
>> blocking after loading.
>>
>> In my osg::Operation::operator()(osg::Object*) implementation I'm 
>> using the following scheme:
>>
>> osgViewer::Viewer* viewer = 
>> dynamic_cast<osgViewer::Viewer*>(callingObject);
>>     if (viewer)
>>     {
>>         return;
>>     }
>>     else
>>     {
>>         runTheIntersectionVisitor(); ...
>>     }
>> Is there anything else I need to know? Examples for the 
>> osg::Operation are rare and I don't see from the given implementation 
>> if I need to lock anything.
>>
>> Can someone give some insight on this?
>>
>> Cheers
>> Sebastian
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
>>
>
> _______________________________________________
> 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