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!
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to