Book Image

OpenSceneGraph 3 Cookbook

By : Rui Wang, Xuelei Qian
Book Image

OpenSceneGraph 3 Cookbook

By: Rui Wang, Xuelei Qian

Overview of this book

<p>OpenSceneGraph is an open source 3D graphics application programming interface, used by application developers in fields such as visual simulation, computer games, virtual reality, scientific visualization, and modeling. Familiar with its concepts and APIs, and need to improve your knowledge? This book is here to help. With exactly 100 recipes, it will enrich your experience and take you to the next level.<br /><br /><em>OpenSceneGraph 3 Cookbook</em> will escort you into the world of real-time 3D development with OpenSceneGraph, the world famous 3D graphics engine. The book assumes that you are already familiar with some basic concepts, and provides 100 vivid recipes to demonstrate how to utilize the API flexibly and how to implement some practical aspects.<br /><br />The book is divided into 10 chapters, each of which focuses on one topic. Readers may start from any topic they are interested in.<br /><br />The book includes customizing OpenSceneGraph, designing scene graph, geometry, scene navigation, animations, effects using fixed pipeline and shaders, managing mass data, and miscellaneous discussions. Every recipe will prove to be useful in a practical way or in research.<br /><br /><em>OpenSceneGraph 3 Cookbook</em> gives you a wide insight about 3D programming using OpenSceneGraph, with a set of meaningful and interesting examples.</p>
Table of Contents (15 chapters)
OpenSceneGraph 3 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface

Generating the API documentation


Before we start discussing this recipe, open the following link and have a look at it:

http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/

Some of you may say: "Oh, this is a wonderful reference guide for me during the programming work. It's impossible to keep all the classes in mind, and it's really rough to search for one method or function in the vast source directory. I'd love to have such a handy API document. But how did you make it, and how do you keep it fresh?"

Believe it or not, all this documenting work could be done by automatic generators, for example, Doxygen in our case. It will parse the source code and comments in prescribed forms, and output formatted results to HTML pages, or even CHM files.

And with the well-written build scripts, OSG can create such API documentation with the Doxygen tool in a very simple way.

Getting ready

Download the Doxygen tool first, and you can generate beautiful documents from the source code. The download link is:

http://sourceforge.net/projects/doxygen/files/

There is a dot utility created by the Graph Visualization Software. It can draw some types of hierarchical graphs and thus makes life more colorful. The toolkit can be found at:

http://www.graphviz.org/Download..php

Ubuntu users can install these two utilities with the apt-get command directly by running the following two command lines:

# sudo apt-get install doxygen
# sudo apt-get install graphviz

Lastly, Windows users may choose to compile a CHM file. Microsoft HTML Workshop is required in this situation. If you don't have one, download it at:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc

How to do it...

  1. 1. Start the cmake-gui window. Don't worry about a completely new compilation, which may take another few hours again. This time we are going to configure options for documentation building only.

  2. 2. Find the BUILD group and click on BUILD_DOCUMENTATION. Click on Configure for more choices.

  3. 3. A new group named DOXYGEN appears after reconfiguring. Look into the group and ensure that the doxygen and dot executables are set properly. Windows users may have to specify the locations of doxygen.exe and dot.exe manually.

  4. 4. Another group DOCUMENTATION is used to decide whether we should build with the option HTML_HELP (CHM file). Selecting it means we are going to compile HTML documents into a CHM file. It requires hhc.exe from the HTML Workshop as the executable.

  5. 5. For Windows users only, set up the location of hhc.exe and the Html Help SDK library. The latter can be found in the Windows SDK distribution.

  6. 6. The common make and make install commands won't affect the generation of API documents. Use the following commands to obtain the OpenThreads and OpenSceneGraph API documents:

    # sudo make doc_openthreads
    # sudo make doc_openscenegraph
    
    
  7. 7. Use any browser to open the index.html file in the /doc/OpenSceneGraphReferenceDocs/ folder in your build directory. See what great work you have just done!

There's more...

If you have generated Visual Studio solution files, find the sub-project DoxygenDoc and build it separately. The ALL_BUILD and INSTALL projects, which must be run to compile and install all OSG libraries and applications, can never affect the compilation of documents, and vice versa. So you may build the API documents without building OSG.

Note

Interested in the generation of API documents? Or do you want your own project to be documented in such an automatic process too? Change your commenting habit from now on. Doxygen will try to recognize some special forms of comments and create great-looking and practical reference manuals for you. See the link below for more details:

http://www.stack.nl/~dimitri/doxygen/manual.html