Openscenegraph is a large open-source project. It takes some time to compile the project by yourself. In addition, there are often reasons for dependency libraries that often fail to compile the program. Another problem with open source is that documents sometimes cannot keep up with the source code, which is the most annoying thing. After several days of exploration, I read the relevant articles on www.openscenegraph.org and finally compiled them in the VC ++ 2005 environment. I will share the following:
1. Get the OSG source code:
1. SVN method:
See http://www.openscenegraph.com/index.php? Page = downloads. SVN
Disadvantage: slow speed
2. Maid (recommended. This is the basis of the following descriptions ):
The latest source code is automatically generated. Address: http://openscenegraph.org/downloads/developer
Advantage: the speed is fast and the source code remains up-to-date.
2. Third-Party code retrieval:
Skip this step if you only compile core osgxxxx.
Because OSG has some plug-ins that require the support of third-party libraries, you must find the corresponding libraries before compilation is complete.
From http://www.openscenegraph.com/index.php? Page = downloads. dependencies can get a Win32 library compressed package (http://openscenegraph.org/downloads/dependencies/3rdParty_Win32binaries_2005_05_10.zip)
Iii. preparation:
Prepare an empty directory named OSG
Create four directories:
Decompress the downloaded maid and 3rdparty to this directory.
The directory structure is as follows:
3rdparty_xxxxxx
Openscenegraph_xxxxxx
Openthreads_xxxxx
Producer_xxxx
Rename these folders to 3 rdparty, openscenegraph, openthreads, and producer.
4. Compile openthreads and producer
Go to openscenegraph/openthreads/win32_src, open openthreads. DSW, and convert the project as prompted.
Various types of debug, release, debug static, and release static are compiled each time. Four libraries are available for later use.
The compilation methods of producer are basically the same.
5. Compile openscenegraph:
This article is reprinted. For the original article, see www.hesicong.net.
Go to the openscenegraph/visualstudio directory and you will see openscenegraph. DSW. After you open it directly, vs2005 will prompt you to convert it to a vc8 project, convert it, and save the SLN file.
Because there are many files, the loading time will be slow. Please wait.
Next we will start batch compilation.
1. Ensure sufficient disk space. After compiling core, plugin, and example in debug and release modes, the OSG directory consumes a total of 3 GB hard disk space. If there are other projects to be compiled, larger disk space may be required.
2. Menu-generate-Batch generate
3. Select the project to be compiled.
Generally, it is enough to configure debug and release. Debug is used for self-writing program debugging, and release is used for the final release. Do not select static link libraries such as debug static and release static; otherwise, a large amount of disk space and Compilation Time are consumed.
The compiled project must contain at least core XXX. Osgplugin and example depend on the situation.
4. Press "generate" to start a long compilation process. At this time, you can go out to bask in the sun or have a good meal. If you have compiled example, you are recommended to take another nap, so that you have more energy to handle compilation errors :)
6. General compilation errors:
This article is reprinted. For the original article, see www.hesicong.net.
1. Some libraries cannot be found, which are common in openthread32.lib and producer. Lib. Check whether all directories are correctly placed. Make sure necessary files are generated.
2. the header file cannot be found. If an error occurs while compiling osgplugin, you can try to find other libraries. The Library in 3rdparty is incomplete. For example, the new osgplugin colldia Dae cannot be compiled, and a few header files are missing.
3. the exported function cannot be found. For example, if osgsim: xxxxxxx is not found, make sure you have generated the osgsim project.
4. More questions: Subscribe to openscenegraph mailing-list
6. Run examples
It is best to run the compiled examples in shell.
Go to OSG/openscenegraph/visualstudio and run osgshell. bat. This batch file registers some variables for the program to use.
This article is reprinted. For the original article, see www.hesicong.net.
7. If there is any problem
Confirm to follow this step. If you have any questions, please leave a message.
For other questions, please subscribe to openscenegraph mailling-list, provided that you have a good foundation in English :)
Success!
This article is reprinted. For the original article, see www.hesicong.net.