|
在HUD中使用拖拽器Translate2DDragger,y轴移动和鼠标反向,而且很快,x轴的移动方向正确,但相当慢。
HUD创建:- osg::ref_ptr<osg::Camera> EditIntersectionCommand::getHUDCamera(
- osg::ref_ptr<osg::Group> aNode,
- const OrthoParameter& aOrthoParameter) const
- {
- osg::ref_ptr<osg::Camera> camera = new osg::Camera;
- //设置透视矩阵
- camera->setProjectionMatrixAsOrtho2D(
- aOrthoParameter._left,
- aOrthoParameter._right,
- aOrthoParameter._bottom,
- aOrthoParameter._top);
- camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
- //得到默认设置
- camera->setViewMatrix(osg::Matrix::identity());
- //设置背景为透明,否则的话可以设置ClearColor
- camera->setClearMask(GL_DEPTH_BUFFER_BIT);
- //设置渲染顺序,必须在最后渲染
- camera->setRenderOrder(osg::Camera::POST_RENDER);
- camera->addChild(aNode);
- camera->getStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
- return camera;
- }
复制代码 跪求解答!!!! |
|