|
我将osg文件添加到屏幕中使其显示出来 设camera的时候写上这句话osg文件内容就显示不出来 这是怎么回事呢 _buttonCamera->setProjectionMatrix(osg::Matrix:rtho2D(0.0f, width, 0.0f, height));
代码:
void TrInterfaceLine::initLineEnv(unsigned int width ,unsigned int height)
{
if(_buttonCamera == NULL)
{
std::cout<<"The _buttonCamera NULL"<<std::endl;
return;
}
else
{
_buttonCamera->setProjectionMatrix(osg::Matrix::ortho2D(0.0f, width, 0.0f, height));
//_buttonCamera->setViewport(-150.0f,50.0f, width,height);
_buttonCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
_buttonCamera->setViewMatrix(osg::Matrix::identity());
_buttonCamera->setClearMask(GL_DEPTH_BUFFER_BIT);
_buttonCamera->setRenderOrder(osg::Camera:OST_RENDER);
_buttonCamera->setAllowEventFocus(false);
}
}
void TrInterfaceLine:oadLine()
{
osg::MatrixTransform* P11 = new osg::MatrixTransform;
P11->setDataVariance(osg::Object::STATIC);
P11->setMatrix(osg::Matrix::translate(osg::Vec3(0.0f,0.0f,0.0f))*osg::Matrix::scale(0.9,1,0.9));
P11->addChild(osgDB::readNodeFile("line.osg"));
_switchSetButton->addChild(P11);
}
osg::Camera* TrInterfaceLine::GetButtonCamera(osg::Node* node)
{
_buttonCamera->addChild(node);
return _buttonCamera;
} |
|