|
楼主 |
发表于 2012-11-30 19:59:38
|
显示全部楼层
array 发表于 2012-11-30 11:04
多半是线程同时操作导致的冲突问题,可以尝试改写一下那个command buffer的例子
array老师,还是不行啊,插件还是崩溃,太菜了,完全搞不懂这个线程这个东西的概念。。。。- bool PickHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
- {
- switch(ea.getEventType())
- {
- case(osgGA::GUIEventAdapter::PUSH):
- {
- OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
-
- osgViewer::View* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
- if (viewer) pick(viewer,ea);
- return false;
- }
- default:
- return false;
- }
- }
- void PickHandler::pick(osgViewer::View* viewer, const osgGA::GUIEventAdapter& ea)
- {
- float x = ea.getX();
- float y = ea.getY();
- osgUtil::LineSegmentIntersector::Intersections interSections;
- viewer->computeIntersections(x,y,interSections);
- }
复制代码 |
|