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