[osg-users] How to check if pagedLod already exists in databasepager with same filename

Simone Rapposelli simone.rapposelli at gmail.com
Tue Nov 29 06:43:23 PST 2016


Hi Robert,

by increasing TargetMaximumNumberOfPageLOD the problem of having to reload the same PageLod disappears, so it works!!
Thank you!


robertosfield wrote:
> Hi Simone,
> 
> On 29 November 2016 at 12:37, Simone Rapposelli
> <> wrote:
> 
> > thank you for your fast reply.
> > My problem is that osgDB::ReaderWriter::ReadResult readNode(const std::string &fileName, const osgDB::ReaderWriter::Options *options) gets called even if a PagedLod with the same fileName has been previously loaded: for example, this happens if I move to any position on the viewer and then come back.
> > Thus, inside this function I need to check if any of the PagedLod currently loaded in DatabasePager has the same fileName of the passed argument: in this case I could avoid to reload data already in memory.
> > 
> 
> The PagedLOD/DatabasePager paging scheme is designed to expire and
> reload subgraphs, it *crucial* to load balancing.  If you cached all
> loaded subgraphs your memory would rapidly be overwhelmed and your
> system would grind to a halt.  The very scheme you are trying to
> defeat is one of the best assets of the OSG, you *absolutely* do not
> want to be breaking this mechanism.
> 
> Now, if you the defaults the paging scheme uses for load balancing is
> too conservative w.r.t the number of PagedLOD it will aim for in
> memory at one time you can adjust it to be higher simply by setting
> the TargetMaximumNumberOfPageLOD parameter, from the DatabasePager
> header you'll see:
> 
> /** Set the target maximum number of PagedLOD to maintain in memory.
> * Note, if more than the target number are required for
> rendering of a frame then these active PagedLOD are excempt from being
> expiried.
> * But once the number of active drops back below the target
> the inactive PagedLOD will be trimmed back to the target number.*/
> void setTargetMaximumNumberOfPageLOD(unsigned int target) {
> _targetMaximumNumberOfPageLOD = target; }
> 
> You can also set the default value using the env var OSG_MAX_PAGEDLOD
> i,e under bash:
> 
> export OSG_MAX_PAGEDLOD=2000
> osgviewer mypageddatabase.osgb
> 
> You can get a listing of the env vars supported by doing:
> 
> osgviewer --help-env
> 
> Robert.
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69530#69530








More information about the osg-users mailing list