|
小弟是菜鸟,对这些C++很是郁闷。不知咋弄。请大家帮忙看看。对这个渲染器一窍不通。
tracker->setImage(video.get());
osgART::TrackerCallback::addOrSet(root.get(), tracker.get());
osg::ref_ptr<osgART::Marker> marker = tracker->addMarker("single;data/patt.hiro;80;0;0");
if (!marker.valid())
{
// Without marker an AR application can not work. Quit if none found.
osg::notify(osg::FATAL) << "Could not add marker!" << std::endl;
exit(-1);
}
marker->setActive(true);
osg::ref_ptr<osg::MatrixTransform> arTransform = new osg::MatrixTransform();
arTransform->setUpdateCallback(new osgART::MarkerTransformCallback(marker.get()));
arTransform->getUpdateCallback()->setNestedCallback(new osgART::MarkerVisibilityCallback(marker.get()));
arTransform->getUpdateCallback()->getNestedCallback()->setNestedCallback(new osgART::TransformFilterCallback());
osg::ref_ptr<osg::MatrixTransform> arMT = new osg::MatrixTransform();
arMT->addChild(osgDB::readNodeFile("robot.osg"));
arTransform->addChild(arMT.get());
arTransform->getOrCreateStateSet()->setRenderBinDetails(100, "RenderBin");
osg::ref_ptr<osg::Group> videoBackground = createImageBackground(video.get());
videoBackground->getOrCreateStateSet()->setRenderBinDetails(0, "RenderBin");
osg::ref_ptr<osg::Camera> cam = calibration->createCamera();
cam->addChild(arTransform.get());
cam->addChild(videoBackground.get());
root->addChild(cam.get());
video->start();
return viewer.run();
上面是红色是添加的代码。我怎么弄就是不显示。 |
|