Time for action—building a quad-tree for massive rendering

This is the last example in our OSG beginners' book, in which we would like to show how OSG handles massive data (often massive terrain data) with the quad-tree structure and paged nodes (osg::PagedLOD). We are going to construct a terrain model with fake elevation data, and use a recursion to build all child cells of a complete quad-tree. These cells are saved into separate files and managed by the osgDB::DatabasePager, which is introduced in brief in Chapter 5, Managing Scene Graph

  1. Include the necessary headers:
    #include <osg/ShapeDrawable>
    #include <osg/PagedLOD>
    #include <osgDB/WriteFile>
    #include <sstream>
    
  2. Define some global variables. These will define the dimensions of a regularly-spaced ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.