|
楼主 |
发表于 2014-8-13 23:10:56
|
显示全部楼层
本帖最后由 rubby 于 2014-8-13 23:12 编辑
此外,我实验如下方法:仍然是截屏是一篇黑。。。。。哪位大侠 指点迷津。。。
- while(!viewer->done())
- {
-
- osg->PreFrameUpdate();
-
- if(osg->m_saveScreenshot){
- osg::ref_ptr<osg::Image> image = new osg::Image;
- int width = osg->viewClientRect.right - osg->viewClientRect.left;
- int height = osg->viewClientRect.bottom - osg->viewClientRect.top;
- image->allocateImage(width, height, 24,GL_RGB, GL_UNSIGNED_BYTE);
- osg::ref_ptr<osg::Camera> camera = viewer->getCamera();
- camera->attach(osg::Camera::COLOR_BUFFER, image.get());
- viewer->frame(); //绘制此帧
- osgDB::writeImageFile(*(image.get()), osg->osgSavePath );
- // camera->attach(osg::Camera::COLOR_BUFFER, NULL,0U,0U);
- osg->m_saveScreenshot =false;
- }else{
- viewer->frame();//绘制此帧
- }
- osg->PostFrameUpdate();
- Sleep(10);
- }
- ;
复制代码 |
|