every blog every motto: You will never know unless you try
0. Preface
Bless me, the program can run through after compiling
- win10
- vs2015
1. Text
1.1 Required installation packages
- OpenSceneGraph3.4.0 installation package, download link
- OSG official sample packet download link
- Install source tool cmake download link
- OSG third-party libraries download link
Note: OSG third-party tools need to download different versions according to the vs version.
All installation packages: Baidu network disk link, extraction code: 0xmx
1.2 Specific steps
1.2.1 cmake compile source code
1. Third-party libraries
Create an OSG folder on the c drive,
unzip the third-party library to the 3rdParty folder, pay attention to the organization of the folder, and don’t have redundant directories
2. OpenSceneGraph installation package
Unzip the 3.4.0 installation package into OSG and
create two new folders in the folder at the same time,
pay attention to the organization of the files, there are no extra files
3. OpenSceneGraph-Data installation package
Unzip the installation package to the folder in OSG.
Pay attention to the organization of the files, there are no extra files
4. cmake
Unzip it to the OSG folder (you can put it in other folders) and
configure the bin path of cmake to the environment variable
Path:
C:\OSG\cmake-3.8.2-win64-x64\bin
cmd open the console and enter cmake --version to see if the installation is successful
Open the cmake-gui.exe in the bin path
as shown in the figure below, drag the CMakeLists.txt in OpenSceneGraph to cmake, and modify the second path to build.
Note: 64-bit is selected here, otherwise the default is 32-bit, followed by Part of the data cannot be generated.
Click configure to configure:
modify two of them:
- First place, tick
- The second place, set the path to the bin folder created above
- In the third place, ACTUAL_3RDPARTY_DIR, the path should be modified to C:\OSG\3rdParty
Note: The default 3rdparty, p is lowercase.
After modification:
Click configure again to configure
. Check the following two places.
After the configuration is completed for the last time , no red area appears. Click generate
to complete:
1.2.2 Compile the program in VS
Open OpenSceneGraph.sln in "C:\OSG\OpenSceneGraph-3.4.0\build" with vs,
menu bar: Build -> Batch build :
select Debug and Release.
Generate install
complete
1.2.3 Configure environment variables
1. Add the following environment variables
variable name | value |
---|---|
OSG_ROOT | C:\OSG\OpenSceneGraph-3.4.0 |
OSG_BIN_PATH | %OSG_ROOT%\bin\bin |
OSG_LIB_PATH | %OSG_ROOT%\bin\lib |
OSG_INCLUDE_PATH | %OSG_ROOT%\bin\include |
OSG_FILE_PATH | C:\OSG\OpenSceneGraph-Data-3.4.0 |
2. Add the following PATH environment variable
- %OSG_BIN_PATH%
1.2.4 Test
win + r -> cmd to open the console
and test in turn:
- osgversion
- osglogo
- osgviewer cow.osg
A familiar cow appeared, it should be matched
references
[1] https://github.com/openscenegraph/OpenSceneGraph
[2] http://www.openscenegraph.org/index.php/download-section/developer-releases
[3] https://github.com/bjornblissing/osg-3rdparty-cmake
[4] http://www.openscenegraph.org/index.php/download-section/dependencies
[5] https://blog.csdn.net/qq_33276585/article/details/89306776
[6] https://blog.csdn.net/u012288722/article/details/78440940
[7] http://www.mamicode.com/info-detail-2649551.html
[8] https://blog.csdn.net/u011231598/article/details/80338941
[9] https://www.jianshu.com/p/7fb0e414e1a9
[10] https://blog.csdn.net/weixin_42416780/article/details/85128412
[11] http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows/37-visual-studio
[12] https://www.jianshu.com/p/24c1650fc36a
[13] https://www.jianshu.com/p/7fb0e414e1a9
[14] https://www.polarxiong.com/archives/%E8%A7%A3%E5%86%B3CMake%E5%AF%BC%E8%87%B4%E7%9A%84-%E6%A8%A1%E5%9D%97%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B1%BB%E5%9E%8Bx64%E4%B8%8E%E7%9B%AE%E6%A0%87%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B1%BB%E5%9E%8BX86%E5%86%B2%E7%AA%81-%E7%9A%84%E9%97%AE%E9%A2%98.html