I am working on a VRJuggler project that uses OSG as its scenegraph.  I need
to use a PagedLOD for the terrain because of its size.  I used Virtual
Planet Builder to generate the PagedLOD and added that PagedLOD to the
scenegraph as a node.  The application shows only the lowest resolution
model of the terrain.

I found a message in the osg-users and vpb archive titled "LOD Problem" from
26 May 2009 about the same problem.  Simply, VRJuggler uses
osgUtil::SceneView and not osgViewer so support for database paging is not
present.  Supposedly, if that support were added, it PagedLODs would operate
properly.

I have tried to build support for osgDB::DatabasePager into my application
as it is included in osgViewer but that has not solved my problem.  The
modifications to the generic OSG Juggler sample app code are at the end of
this message.  I would appreciate any advice on either what I have missed or
what I have not done correctly in this code.  I can send the entire
Application.cpp file if needed.

Thank you for your help,
Levi

The code segments:

void Application::init()
{
    // Initialize the head proxy - used for keeping time
    _head.init("VJHead");
}

void Application::initScene()
{
    _rootNode = getScene();

    setDatabasePager(osgDB::
DatabasePager::create());
    setImagePager(new osgDB::ImagePager);

    _databasePager->registerPagedLODs(getScene()); // I assume this looks
for PagedLODs in the entire scenegraph?
}

osg::Group* Application::getScene()
{
    // return the current scene graph
    return the<SceneGraph>().rootGroupNode();
}

void Application::setDatabasePager(osgDB::DatabasePager* dp)
{
    _databasePager = dp;
}

void Application::setImagePager(osgDB::ImagePager* ip)
{
    _imagePager = ip;
}

void Application::preFrame()
{
    // Get time from juggler head proxy
    _headTime = _head->getTimeStamp().secd();

    vrj::OsgApp::preFrame();
}

void Application::latePreFrame()
{
    if(_frameStamp) {

        _databasePager->registerPagedLODs(getScene()); // this should not be
necessary

        // Update all the framestamp information
        _frameStamp->setFrameNumber(_frameCount);
        _frameStamp->setReferenceTime(_headTime);
        _frameStamp->setSimulationTime(_headTime);
        _frameCount++;

        update();
    }

    vrj::OsgApp::latePreFrame();
}

void Application::configSceneView(osgUtil::SceneView* newSceneViewer)
{
     _frameStamp = new osg::FrameStamp;
     newSceneViewer->setFrameStamp(_frameStamp.get());
}

void Application::update()
{
    _databasePager->updateSceneGraph(*_frameStamp);
    _imagePager->updateSceneGraph(*_frameStamp);
}
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to