OSG--64位系统上的环境配置(VS2012)

刚刚接触OSG,折腾了一通,总算是把开发环境搭建起来了,有兴趣的朋友可以参考:

准备:

1.新建目录../OpenSceneGraph,从svn上checkout源代码至目录下;新建目录../OpenSceneGraph/3rdparty,下载第三方库:OpenSceneGraph-3.0.1-VS10.0.30319-x64-release-12741至目录,压缩文件亦可

2.下载cmake,通过cmake移植到目标环境,本人是win7 64位家庭版,工具为VS2012 Pro版

步骤:

1.运行cmake,设置source code为../OpenSceneGraph,build the binary为/OpenSceneGraph

2.点击configure,选择generator为Visual Studio 11 Win64,点击Finish

3.配置ungrouped entries->ACTUAL_3RDPARTY_DIR为../OpenSceneGraph/3rdparty,其他默认,其他的可以根据自己需要配置,点击Generate,不出意外,生成成功

4.在../OpenSceneGraph下打开openscenegraph.sln工程,在Solution Explorer中展开CMakePredefinedTargets,右键点击Install,选择build

然后,一段很长的时间过去了......

5.编译完成后,新建project,配置属性->配置管理器->Active solution platform中选择新建,选择x64,保存;配置Configuration Properties->Character Set为Use Multi-Byte Character Set

6.配置c/c++->AdditionalIncludeDirectories为../OpenSceneGraph/include

7.配置Linker->AdditionalLibraryDirectories为../OpenSceneGraph/lib

8.配置Linker->Input->Additional Dependencies为:osgDBd.lib;osgViewerd.lib;OpenThreadsd.lib;osgd.lib;osgUtild.lib

9.新建源文件,加入以下代码:

 

  
  
  
  
  1. #include <osgDB/ReadFile> 
  2. #include <osgViewer/Viewer> 
  3. int main( int argc, char** argv ) 
  4.     osgViewer::Viewer viewer; 
  5.     viewer.setSceneData( osgDB::readNodeFile("cessna.osg") ); 
  6.     return viewer.run(); 

10.配置系统环境变量:

PATH=..;绝路路径/OpenSceneGraph/bin

OSG_FILE_PATH=绝对路径/OpenSceneGraph/data

11.编译project,运行,OK

你可能感兴趣的:(OSG)