Robert,

Things seem to work fine if I only call advance() when a render is done.
Off the top of your head, can you think of any problems that might be caused
by not doing an advance for every iteration of the event and update
traversals?  Would it be better to advance the reference time at each
iteration and only advance the frame number when a render is performed?

Also in regards to the potential problems with pre-compiling objects, I
assume that I can just call requiresCompileGLObjects on the pager in each
iteration of the main loop and then do a render if it returns true.  My main
concern is doing unnecessary renders while the pager is downloading tiles
from an internet source.

Thanks for all your help.

Evan


On Thu, Apr 23, 2009 at 10:16 AM, Robert Osfield
<robert.osfi...@gmail.com>wrote:

> On Thu, Apr 23, 2009 at 4:32 PM, Robert Osfield
> <robert.osfi...@gmail.com> wrote:
> > Thanks Evan, with your example I'm able to see the problem when
> > browsing http://www.openscenegraph.org/data/earth_bayarea/earth.ive.
> > I'll now dig into the DatabasePager to see what is up.
>
> The culprit looks to be the following (normally valid) code in
> DatabasePager::capped_removeExpiredSubgraphs(const osg::FrameStamp&
> frameStamp):
>
>        int delta = frameStamp.getFrameNumber() -
> plod->getFrameNumberOfLastTraversal();
>        if (delta>1)
>        {
>            if (_releaseDelay!=DBL_MAX)
>            {
>                plod->releaseGLObjects();
>
> osg::notify(osg::NOTICE)<<"DatabasePager::removeExpiredSubgraphs(),
> releasing gl objects"<<std::endl;
>            }
>
>            _inactivePagedLODList.push_back(plod);
>
>            itr = _activePagedLODList.erase(itr);
>        }
>
>
> The only reason why this is a problem in this particular usage case is
> that you have a viewer that is continue to increment the frame count
> so the  frameStamp.getFrameNumber() keeps getting incremented, but
> since the scene isn't being rendering the
> plod->getFrameNumberOfLastTraversal() is not updating so the frame
> delta becomes > 1 and the PagedLOD gets assigned as expired.
>
> The code in DatabasePager is correct for how the pager + PagedLOD were
> designed to be used.  The problem is that code is now being used in
> way that is wasn't originally intended.  Updating the frame count and
> not rendering is the problem.  Not updating the frame count and not
> rendering would work, as does updating the frame count and rendering.
>
> The next question is how to either get the viewer or DatabasePager to
> do what is desired here - i.e. lazy updating of the graphics.  It
> might be possible to tell the DatabasePager that rendering of frame is
> switched off for that frame and for it handle this case.  Tweaking the
> application code so that it doesn't do an viewer.advance() until a new
> frame is actually required.
>
> It's also worth noting that there is a potential bug in the supplied
> viewer that does lazy update - it only will ever work if the pager
> isn't doing precompile, if it does do precompile then you have to
> render frames to enable the pager to get it's GL objects compiled,
> otherwise the pager will just go to sleep waiting for the objects to
> be compiled by the rendering thread(s), then you'd have stale mate.
> A possible way to solve this would be to check the DatabasePager to
> see if it has any database requests that are still active, and keeping
> rendering while it does.
>
> Robert.
> _______________________________________________
> 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