|
我用addchild添加了一个子相机来俯视地面,可是为什么没有图像显示呢?请帮忙解释下呗。代码如下
//创建从属相机
osg::Camera* cameraClient3 = new osg::Camera();
cameraClient3->setGraphicsContext(gc);
cameraClient3->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
GLenum bufferClient3 = traits->doubleBuffer ? GL_BACK : GL_FRONT;
cameraClient3->setReadBuffer(bufferClient3);
cameraClient3->setDrawBuffer(bufferClient3);
osg::Vec3d eagleeye=(osg::Vec3d(0,0,70));
osg::Vec3d eaglecenter=(osg::Vec3d(0,0,0));
osg::Vec3d eagleup=(osg::Vec3d(0,1,0));
cameraClient3->setProjectionMatrixAsPerspective(120,2,10,1000);
cameraClient3->setViewport(new osg::Viewport(0,460, 200,140));
cameraClient3->setViewMatrixAsLookAt(eagleeye,eaglecenter,eagleup);
root->addChild(cameraClient3); |
|