Book description
This book is a concise introduction to the main features of OpenSceneGraph which then leads you into the fundamentals of developing virtual reality applications. Practical instructions and explanations accompany you every step of the way.
- Gain a comprehensive view of the structure and main functionalities of OpenSceneGraph
- An ideal introduction for developing applications using OpenSceneGraph
- Develop applications around the concepts of scene graphs and design patterns
- Extend your own scene elements from the base interfaces of OpenSceneGraph
- Packed with examples, this book explains each knowledge point in detail and makes you practice your knowledge for better understanding
In Detail
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.
With plenty of examples to get you started quickly, you'll master developing with OpenSceneGraph in no time, the 3D graphics engine based on OpenGL
Table of contents
-
OpenSceneGraph 3.0
- Table of Contents
- OpenSceneGraph 3.0
- Credits
- Foreword
- About the Authors
- Acknowledgement
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. The Journey into OpenSceneGraph
-
2. Compilation and Installation of OpenSceneGraph
- System requirements
- Using the installer
- Time for action—installing OSG
- Running utilities
- Time for action—playing with osgviewer
- Using the project wizard
- Time for action—creating your solution with one click
- Prebuilts making trouble?
- Cross-platform building
- Starting CMake
- Time for action—running CMake in GUI mode
- Setting up options
- Generating packages using Visual Studio
- Time for action—building with a Visual Studio solution
- Generating packages using gcc
- Time for action—building with a UNIX makefile
- Configuring environment variables
- Summary
-
3. Creating Your First OSG Program
- Constructing your own projects
- Time for action—building applications with CMake
- Using a root node
- Time for action—improving the "Hello World" example
- Understanding memory management
- ref_ptr<> and Referenced classes
- Collecting garbage: why and how
- Tracing the managed entities
- Time for action—monitoring counted objects
- Parsing command-line arguments
- Time for action—reading the model filename from the command line
- Tracing with the notifier
- Redirecting the notifier
- Time for action—saving the log file
- Summary
-
4. Building Geometry Models
- How OpenGL draws objects
- Geode and Drawable classes
- Rendering basic shapes
- Time for action—quickly creating simple objects
- Storing array data
- Vertices and vertex attributes
- Specifying drawing types
- Time for action—drawing a colored quad
- Indexing primitives
- Time for action—drawing an octahedron
- Using polygonal techniques
- Time for action—tessellating a polygon
- Rereading geometry attributes
- Customizing a primitive functor
- Time for action—collecting triangle faces
- Implementing your own drawables
- Using OpenGL drawing calls
- Time for action—creating the famous OpenGL teapot
- Summary
-
5. Managing Scene Graph
- The Group interface
- Managing parent nodes
- Time for action—adding models to the scene graph
- Traversing the scene graph
- Transformation nodes
- Understanding the matrix
- The MatrixTransform class
- Time for action—performing translations of child nodes
- Switch nodes
- Time for action—switching between the normal and damaged Cessna
- Level-of-detail nodes
- Time for action—constructing a LOD Cessna
- Proxy and paging nodes
- Time for action—loading a model at runtime
- Customizing your own NodeKits
- Time for action—animating the switch node
- The visitor design pattern
- Visiting scene graph structures
- Time for action—analyzing the Cessna structure
- Summary
-
6. Creating Realistic Rendering Effects
- Encapsulating the OpenGL state machine
- Attributes and modes
- Time for action—setting polygon modes of different nodes
- Inheriting render states
- Time for action—lighting the glider or not
- Playing with fixed-function effects
- Time for action—applying simple fog to models
- Lights and light sources
- Time for action—creating light sources in the scene
- The Image class
- The basis of texture mapping
- Time for action—loading and applying 2D textures
- Handling rendering order
- Time for action—achieving the translucent effect
- Understanding graphics shaders
- Using uniforms
- Time for action—implementing a cartoon cow
- Working with the geometry shader
- Time for action—generating a Bezier curve
- Summary
-
7. Viewing the World
- From world to screen
- The Camera class
- Rendering order of cameras
- Time for action—creating an HUD camera
- Using a single viewer
- Digging into the simulation loop
- Time for action—customizing the simulation loop
- Using a composite viewer
- Time for action—rendering more scenes at one time
- Changing global display settings
- Time for action—enabling global multisampling
- Stereo visualization
- Time for action—rendering anaglyph stereo scenes
- Rendering to textures
- Frame buffer, pixel buffer, and FBO
- Time for action—drawing aircrafts on a loaded terrain
- Summary
-
8. Animating Scene Objects
- Taking references to functions
- List of callbacks
- Time for action—switching nodes in the update traversal
- Avoiding conflicting modifications
- Time for action—drawing a geometry dynamically
- Understanding ease motions
- Animating the transformation nodes
- Time for action—making use of the animation path
- Changing rendering states
- Time for action—fading in
- Playing movies on textures
- Time for action—rendering a flashing spotlight
- Creating complex key-frame animations
- Channels and animation managers
- Time for action—managing animation channels
- Loading and rendering characters
- Time for action—creating and driving a character system
- Summary
-
9. Interacting with Outside Elements
- Various events
- Handling mouse and keyboard inputs
- Time for action—driving the Cessna
- Adding customized events
- Time for action—creating a user timer
- Picking objects
- Intersection
- Time for action—clicking and selecting geometries
- Windows, graphics contexts, and cameras
- The Traits class
- Time for action—configuring the traits of a rendering window
- Integrating OSG into a window
- Time for action—attaching OSG with a window handle in Win32
- Summary
-
10. Saving and Loading Files
- Understanding file I/O plugins
- Discovery of specified extension
- Supported file formats
- The pseudo-loader
- Time for action—reading files from the Internet
- Configuring third-party dependencies
- Time for action—adding libcurl support for OSG
- Writing your own plugins
- Handling the data stream
- Time for action—designing and parsing a new file format
- Serializing OSG native scenes
- Creating serializers
- Time for action—creating serializers for user-defined classes
- Summary
-
11. Developing Visual Components
- Creating billboards in a scene
- Time for action—creating banners facing you
- Creating texts
- Time for action—writing descriptions for the Cessna
- Creating 3D texts
- Time for action—creating texts in the world space
- Creating particle animations
- Time for action—building a fountain in the scene
- Creating shadows on the ground
- Time for action—receiving and casting shadows
- Implementing special effects
- Time for action—drawing the outline of models
- Playing with more NodeKits
- Summary
-
12. Improving Rendering Efficiency
- OpenThreads basics
- Time for action—using a separate data receiver thread
- Understanding multithreaded rendering
- Time for action—switching between different threading models
- Dynamic scene culling
- Occluders and occludees
- Time for action—adding occluders to a complex scene
- Improving your application
- Time for action—sharing textures with a customized callback
- Paging huge scene data
- Making use of the quad-tree
- Time for action—building a quad-tree for massive rendering
- Summary
- A. Pop quiz—Answers
- Index
Product information
- Title: OpenSceneGraph 3.0
- Author(s):
- Release date: December 2010
- Publisher(s): Packt Publishing
- ISBN: 9781849512824
You might also like
book
Hacker’s Delight, Second Edition
In Hank Warren once again compiles an irresistible collection of programming hacks: timesaving techniques, algorithms, and …
book
Adobe Photoshop Classroom in a Book (2023 Release)
Learn to create and edit images using Adobe Photoshop Adobe Photoshop Classroom in a Book (2023 …
book
AI for Games, Third Edition, 3rd Edition
AI is an integral part of every video game. This book helps professionals keep up with …
audiobook
Fall in Love with the Problem, Not the Solution
Unicorns-companies that reach a valuation of more than $1 billion-are rare. Uri Levine has built two. …