Book Image

OpenSceneGraph 3.0: Beginner's Guide

Book Image

OpenSceneGraph 3.0: Beginner's Guide

Overview of this book

Virtual reality has quite a lot of demand in computer science today and OpenSceneGraph, being one of the best 3D graphics toolkits, is being used widely. Although you can use the powerful OpenSceneGraph, based on the low-level OpenGL API, to implement virtual-reality applications that simulate different environments in the 3D world, developing picture-perfect applications is easier said than done.This book has been written with the goal of helping readers become familiar with the structure and main functionalities of OpenSceneGraph (OSG), and guide them to develop virtual-reality applications using this powerful 3D graphics engine. This book covers the essence of OpenSceneGraph (OSG), providing programmers with detailed explanations and examples of scene graph APIs.This book helps you take full advantages of the key features and functionalities of OpenSceneGraph (OSG). You will learn almost all of the core elements required in a virtual reality application, including memory management, geometry creation, the structure of the scene graph, realistic rendering effects, scene navigation, animation, interaction with input devices and external user interfaces, file reading and writing, and so on. With the essential knowledge contained in this book, you will be able to start using OSG in your own projects and research fields, and extend its functionalities by referring to OSG's source code, official examples and API documentation. This handy book divides the core functionalities of the proved and comprehensive OpenSceneGraph (OSG) 3D graphics engine into different aspects, which are introduced in separate chapters. Each chapter can be treated as an individual part that covers one important field of OSG programming, along with several examples illustrating concrete usages and solutions. But the sequence of chapters is also organized from the easy to the more difficult, to help you get to grips with OSG.By the end of the whole book, you will have gained a ready-to-use OSG development environment for yourself and have the general ability to develop OSG-based applications and extend practical functionalities for your own purposes.
Table of Contents (22 chapters)
OpenSceneGraph 3.0
Credits
Foreword
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Components


The computing infrastructure of OSG is designed to be highly scalable in order to enable runtime access to extended functionalities. In addition to the standard core libraries, a set of additional modular libraries known as NodeKits have been delivered to meet specific development requirements.

The core OSG functionality consists of four libraries:

  1. The OpenThreads library: This library is intended to provide a minimal and complete Object-Oriented (OO) thread interface for C++ programmers. It is used by OSG as the main threading model implementation.

  2. The osg library: This library provides basic elements used to build scene graphs, such as nodes, geometries, rendering states and textures, as well as related management tools and methods. It also contains a few necessary math classes, which are used to implement vector and matrix operations that are commonly used in two-dimensional and three-dimensional spaces.

  3. The osgDB library: This library provides a plugin mechanism for reading and writing 2D and 3D files, with a derivable class containing access to data files and stream I/O operations. Its built-in database pager also supports dynamic loading and unloading of scene graph segments, in order to achieve the scheduling of huge collections of user data.

  4. The osgUtil library: This library is designed for building the OSG rendering backend, which traverses the scene tree, performs culling in each frame, and finally converts the OSG scene into a series of OpenGL calls. There are also functionalities for user intersections, and polygon modification algorithms.

The extra NodeKits and utilities available with current OSG distributions are:

  • The osgAnimation library: This library provides a range of general purpose utilities for various animations, including skeleton and morphing. It uses generic templates to construct multiple kinds of key frames and animation channels.

  • The osgFX library: This library has a framework for implementing special effects in the 3D space, and contains several useful effect classes.

  • The osgGA library, which stands for OSG GUI abstraction: This library is an abstract user interface on top of various windowing systems. It helps to handle interactive events from peripheral devices, for example, a keyboard or mouse.

  • The osgManipulator library: This library extends the scene graph to support 3D interactive manipulation, such as moving, rotating, and scaling of transformable nodes.

  • The osgParticle library: This library makes it possible to render explosions, fire, smoke, and other particle-based effects.

  • The osgShadow library: This library provides a framework for various shadow rendering techniques.

  • The osgSim library: This library meets some special requirements from simulation systems, especially from the OpenFlight databases.

  • The osgTerrain library: This library provides geographic terrain rendering support using height field and imagery data.

  • The osgText library: This library fully supports the rendering of TypeType and a series of other font formats, based on the FreeType project. It can draw 2D and 3D texts in 3D space or on the screen.

  • The osgViewer library: This library defines a set of viewer-related classes, and therefore integrates OSG scene graphs and renders the backend with a wide variety of windowing systems, including Win32, X11, Carbon, and Cocoa, as well as providing indirect support for many other famous GUI toolkits.

  • The osgVolume library: This library includes an initial support for volume rendering techniques.

  • The osgWidget library: This library extends the core OSG elements and provides a 2D GUI widget set for 3D applications.

  • The osgQt library: This library embeds the Qt GUI into scene graphs and thus has the ability to display web pages and common Qt widgets in space.

All OSG core libraries and NodeKits, no matter what kind of features they implement or who contributed them, have the same prefix "osg", and a short word or abbreviation followed as the keyword.

The whole OSG architecture can be illustrated as follows:

In most cases, the osg, osgDB, osgUtil, and osgViewer libraries are the major components of an OSG-based application, and will be discussed in more detail in the following chapters of this book, while other less frequently used NodeKits may also be mentioned in specific chapters.