Added the ability to release OpenGL objects in PagedLOD subgrphs that are no longer being rendered.

This commit is contained in:
Robert Osfield
2008-10-07 11:35:41 +00:00
parent 6ec4c64914
commit 8c98220878
6 changed files with 142 additions and 3 deletions

View File

@@ -63,6 +63,7 @@ class OSG_EXPORT PagedLOD : public LOD
float _priorityScale;
double _timeStamp;
int _frameNumber;
int _frameNumberOfLastReleaseGLObjects;
osg::ref_ptr<osg::Referenced> _databaseRequest;
};
@@ -122,6 +123,10 @@ class OSG_EXPORT PagedLOD : public LOD
* Return true if children are removed, false otherwise. */
virtual bool removeExpiredChildren(double expiryTime, int expiryFrame, NodeList& removedChildren);
/** Release the GL Objects of the children from the PagedLOD which haven't been visited since specified expiry time and expiry frame number.
* Return true if any children have release called upon them, false otherwise. */
virtual bool releaseGLObjectsOnExpiredChildren(double releaseTime, int releaseFrame);
protected :
virtual ~PagedLOD();

View File

@@ -216,6 +216,24 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
* before being removed.*/
int getExpiryFrames() const { return _expiryFrames; }
/** Set the amount of time that a subgraph's OpenGL objects will be kept without being visited in the cull traversal
* before being released.*/
void setReleaseDelay(double releaseDelay);
/** Get the amount of time that a subgraph's OpenGL objects will be kept without being visited in the cull traversal
* before being released.*/
double getReleaseDelay() const { return _releaseDelay; }
/** Set the number of frames that a subgraph's OpenGL objects will be kept without being visited in the cull traversal
* before being released.*/
void setReleaseFrames(int releaseFrames) { _releaseFrames = releaseFrames; }
/** Get the number of frames that a subgraph's OpenGL objects will be kept without being visited in the cull traversal
* before being released.*/
int getReleaseFrames() const { return _releaseFrames; }
/** Set whether the removed subgraphs should be deleted in the database thread or not.*/
void setDeleteRemovedSubgraphsInDatabaseThread(bool flag) { _deleteRemovedSubgraphsInDatabaseThread = flag; }
@@ -534,6 +552,9 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
double _expiryDelay;
int _expiryFrames;
double _releaseDelay;
int _releaseFrames;
ActiveGraphicsContexts _activeGraphicsContexts;
// CompileGraphicsContexts _compileGraphicsContexts;