其他分享
首页 > 其他分享> > OSG编译安装-MSVC

OSG编译安装-MSVC

作者:互联网

OSG编译安装-MSVC

1、准备工作

1.1 环境

 

1.2 osg下载

 

2、Cmake编译

 

 

 

 

 

 

3、Visual Studio编译

 

 

 

 

4、添加环境变量

 

 

5、测试安装

 

6、Qt程序

INCLUDEPATH += D:/OSG/install/include
DEPENDPATH += D:/OSG/install/include
​
win32:CONFIG(release, debug|release): LIBS += -LD:/OSG/install/lib/ -losg
else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OSG/install/lib/ -losgd
​
win32:CONFIG(release, debug|release): LIBS += -LD:/OSG/install/lib/ -losgViewer
else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OSG/install/lib/ -losgViewerd
​
win32:CONFIG(release, debug|release): LIBS += -LD:/OSG/install/lib/ -losgDB
else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OSG/install/lib/ -losgDBd

 

 

 

 

#include "widget.h"
​
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
​
int main(int argc, char *argv[])
{
​
    QString osgPath = "D:/OSG/OpenSceneGraph-Data/avatar.osg";  // 换成自己的路径
​
    osgViewer::Viewer viewer;                                   // 创建查看器
    osg::Node * node = new osg::Node;
    node = osgDB::readNodeFile(osgPath.toStdString());          // 读取模型文件,赋值给节点指针
    viewer.setSceneData(node);                                  // 查看器中添加该节点
    return viewer.run();                                        // 运行查看器
}

 


 

 

7、编译好的库

链接:https://pan.baidu.com/s/1UfNbJ0fUAzKfe3XrWNVTDA
提取码:66tf

标签:OpenSceneGraph,编译,debug,install,release,MSVC,OSG
来源: https://www.cnblogs.com/IntelligencePointer/p/14942511.html