Here is a simple example of creating a osg::PagedLOD node with two children nodes, one is a local geometry and the other is an external model file.
This code creates a PagedLOD node that displays a box when the eye point is within 1000 units from the node, and displays a cow model when the eye point is beyond 1000 units from the node. The cow model is loaded from the file “cow. osg” in the current directory.
// create a PagedLOD node osg::ref_ptr<osg::PagedLOD> plod = new osg::PagedLOD(); plod->setName("plod for example"); // set the range mode to distance from eye point plod->setRangeMode(osg::LOD::DISTANCE_FROM_EYE_POINT); // create a local geometry as the first child node osg::ref_ptr<osg::Geode> geode = new osg::Geode(); geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),10.0f))); plod->addChild(geode.get()); // set the range of the first child node to [0, 1000] plod->setRange(0, 0.0f, 1000.0f); // set the file name of the second child node to "cow.osg" plod->setFileName(1, "cow.osg"); // set the range of the second child node to [1000, FLT_MAX] plod->setRange(1, 1000.0f, FLT_MAX); // set the database path to the current directory plod->setDatabasePath("./");
So, what are you getting?