Hi Alan,

For the most part you should never need to touch the DatabasePager
even when you are using paged database, the osgViewer will create and
manage the DatabasePager for you when you have paged databases, all
automatically without any need for intervention.  There are no OSG
examples demonstrating it, because there isn't any for the developer
to do extra, you just create your scene graph and attach it the viewer
and it'll do the rest.

The way to access the OSG's paging mechanism is to use the PagedLOD
node, this is a node you place in the scene graph, and can be
serialized out like any other node to a .ive file, and using it you
build a whole quad tree hierachy that can scales in to terrabyte
database without problems, and without any intervention from yourself.
  This means paging is principally an issue of database generation -
this is what the VirtualPlanetBuilder exists for.

The TXP plugin also uses PagedLOD, but with based on the TerraPage
archives which obviously don't know anything about PagedLOD, but the
plugin is able to decorate subgraphs loaded from TerraPage with
PagedLOD to enable it to leverage the DatabasePager.  This could serve
as an example to you if this is type of thing you are trying to
tackle.

Robert.

On Wed, Oct 1, 2008 at 12:06 AM, Alan Ott <[EMAIL PROTECTED]> wrote:
> Hello,
>
> After much trying and failing, I think I have a fundamental misunderstanding
> reagarding the DatabasePager. I have looked for examples or code snippets
> and it seems that there are none. So here's what I have.
>
> I have a DatabasePager object that I use for terrain. When I need a new
> chunk of terrain, I call requestNodeFile() with the name of the tile of
> terrain that I want, and give it a group node to attach it to. Every frame,
> I check my group nodes to see if they have a piece of terrain attached to
> them (ie: see if the pager paged in the terrain and attached it to my
> group). If a new piece of terrain has been loaded, I then perform my
> initialization on it (lookup switch nodes, etc), and attach it to my main
> scene. This gets the job done.
>
> The problem now, is that every time a new tile is attached to the main
> scene, the next frame takes a long time, and I have a missed frame. This has
> to do with the new tile getting compiled (texture sent to OpenGL, etc) when
> it's drawn the first time. To overcome this, I want DatabasePager to do this
> for me, which it seems to be able to support, but everything I try doesn't
> work in one way or another. I have something like the following (roughly):
>
> // Set up the pager
> pager = osgDB::DatabasePager::create();
> pager->setCompileGLObjectsForContextID (0, true);
> pager->setDoPreCompile(true);
> ...
>
> // My composite viewer
> osgViewer::CompositeViewer *viewer = new osgViewer::CompositeViewer;
> ....
>
> // Then for each View I have something like this.
> view = new osgViewer::View;
> view->setSceneData(root.get());
> view->getScene()->setDatabasePager(pager);
>
> So in this case, only what gets requested the first frame (before the first
> draw) gets paged in. Anything requested after that never gets loaded. If I
> take out the call to setCompileGLObjectsForContextID(), of course, no
> precompiling happens. Other things happen if I take out the
> getScene()->setDatabasePager().
>
> From some of the code regarding PagedLOD's, I get the feeling I might be
> going about this the wrong way entirely, and possibly using DatabasePager in
> a way in which it was not designed.
>
> So I guess my question is, does anyone have anything they can tell me about
> how to use this class? Maybe some code snippets? Anything at all would help.
> I've spent a lot of time searching online and digging through the code, so
> if I've missed something obvious, please go easy :)
>
> Alan.
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to