版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/github_39611196/article/details/88170219
本文主要介绍如何解决在MFC窗口程序中实现OSGEarth后黑屏。
原因:
出现该问题的原因是运行后显示出来的结果超出了MFC程序视窗外。
解决方案:
将
camera->setViewport(new osg::Viewport(traits->x, traits->y, traits->width, traits->height));
修改为
camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));