[osg-users] problem with dragging in Osg

Robert Osfield robert.osfield at gmail.com
Fri Jul 4 01:32:16 PDT 2008


Hi Heishuijing, I presume this is your name, in future could you sign
your emails with your name so we know who to address. Thanks.

As for what is causing the crash, with such little info, and no stack
trace is at best clutching at staws. My guess guess would that it's
threading issue, where you viewer is running DrawThreadPerContext and
your own code is modifying Geometry without setting the DataVariance
of it to DYNAMIC.  Set the vewier to SingleThreaded to test this
possibility.

Robert.

On Fri, Jul 4, 2008 at 3:42 AM, heishuijing_2000
<heishuijing_2000 at 126.com> wrote:
> Hi,
>   Recently,i have a problem about dragging in Osg. I want to drag one
> surface of a box and make the box modified. During i am dragging,i modify
> the box constantly.Here what i do.
>   1. I define a class as this:          class ModifyClass : public
> osgGA::GUIEventHandler
>   2. In this function , virtual bool handle(const osgGA::GUIEventAdapter&
> ea,osgGA::GUIActionAdapter& aa)
>      i write a function 'DoDrag' to process the osgGA::GUIEventAdapter::DRAG
> message
>   3. In the 'DoDrag' function,i compute the surface's points from mouse's
> drag,and then modify the surface and other 3 surfaces which is affected by
> the Dragging. Here is what i do:
>      // m_selectedFace is the selected geometry face
>      // p1 p2 p3 p4 are the points of the surface
>      osg::Vec3Array* surfaces = dynamic_cast< osg::Vec3Array* >(
> m_selectedFace->getVertexArray() );
>      surfaces->clear();
>      surafaces->push_back(p1);
>      surafaces->push_back(p2);
>      surafaces->push_back(p3);
>      surafaces->push_back(p4);
>      this->setVertexArray( surfaces  );
>      this->setPrimitiveSet( 0, new osg::DrawArrays(
> osg::PrimitiveSet::POLYGON, 0, surface_ver->size() ) );
>
>   At first ,this does perfect,with my dragging ,the box is changed
> constantly.Unfortunately, after a short time,it is crashed with exception
> error,and then the programe is stopped.
>   I was working with VS2003 and osg2.4 . I really want to know what is the
> error,and what should i do?
>   Anyone help me? Thank you!
>
> ________________________________
> 网易首款免费3D网游"天下2",6月6日激情公测
> _______________________________________________
> 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