|
大概代码如下
osg::Node* node = osgDB::readNodeFile(fileName);
osg::Image* image = new osg::Image();
osg::Camera* camera = new osg::Camera;
camera->setViewMatrixAsLookAt()
camera->setProjectionMatrix();
camera->setReferenceFrame(osg::ABSOLUTE_RE);
camera->setViewPort();
camera->setRenderOrder();
Osg::Camera::RenderTargetImplementation ren = osg::Camera::FRAME_BUFFER_OBJECT;
camera->setRenderTarget(ren);
camera->attach(buf,image);
camera->addchild(node);
osgDB::WriteImageFile(image,"1.png");
上面代码是我手动打的。不能直接用。我的问题是osgDB::WriteImageFile(image,"1.png");
这局话为啥写不出图片。而且image里面东西为空。 |
|