编译环境
osg: 3.6.5
osgEarth: 3.2.0
MSVC2019
osg 和 osgearth 的库文件配置参考这篇文章
编译生成osgQOpenGLWidget
修改CMakeLists 文件
- 添加qt版本和编译器目录
SET(DESIRED_QT_VERSION "5.15.2" CACHE STRING "")
SET(CMAKE_PREFIX_PATH "D:/Solfware/Qt/5.15.2/msvc2019_64" CACHE PATH "")
2.修改osg版本
与安装的osg版本一致
其余内容按照这个文章内容进行即可
将osgEarth嵌入Qt
头文件
#include <osgQOpenGL/osgQOpenGLWidget>
#include <osgEarth/EarthManipulator>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/View>
#include <osgGA/StateSetManipulator>
#include <osgGA/TrackballManipulator>
#include <osgGA/GUIEventHandler>
#include <osgGA/NodeTrackerManipulator>
#include <osgGA/FirstPersonManipulator><