Hi Braden,

I can't see a way for us to directly help you as the problem is in your own
code, the code snippet your've provided doesn't appear to tally with the
error message you've reported so we are really far more in the dark than
you.

The only thing I can say is that in general it should be fine to modify
geometry during the update or event traversals like you are doing, but if
you viewer is running mulit-threaded (the osgViewer will run multi-thread
if you have multi-cores by default) then you'll need to tell the OSG that
those objects you are modifying are dynamically modified by setting their
DataVariance to DYNAMIC, i.e. geometry->setDataVariance(osg::DYNAMIC); as
this will tell the draw traversal not to let the next frame to commence
till this dynamic objects has been rendered.

Robert.


On 7 May 2013 20:14, Braden Edmunds <edmu...@reaction-eng.com> wrote:

> I've roughly followed the osgmanipulator.cpp example to create
> osgManipulator::Translate1DDragger objects and link them to my custom
> geometry items and everything works fine. I'm encountering a problem when I
> try to update a geometry item inside of the traverse method. The following
> code is where it breaks:
>
>
> Code:
>
> void DraggerContainer::traverse(osg::NodeVisitor &nv)
> {
>  //setup
> ....
>
> //
> osg::Vec3 trans = _dragger->getMatrix().getTrans();
>
> _dragger->setMatrix(
> osg::Matrix::rotate(osg::inDegrees(degrees),rotationAxis)
> * osg::Matrix::scale(scaleFactor)
> * osg::Matrix::translate(trans)); //re-position the draggable item
>
> if(prev_trans.length() != trans.length())
> {
>         UpdateGeometry(trans); // <------- Breaks after this returns
> }
>
> osg::Group::traverse(nv);
> }
>
>
>
>
> The error is "vector iterator not incrementable  vector line 99," but this
> error is only produced after running through functions in viewer.dll and
> osg.dll.
>
> I'm wondering if this is the correct way to extrude geometry on the fly,
> and if adding nodes during the traverse call will cause an iterator to
> become invalid.
>
> Thanks in advance,
>
> Braden
>
>
> [/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53946#53946
>
>
>
>
>
> _______________________________________________
> 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