Updates to the flush rendering objects function calls to allow for

managment of amount of time available to do gl delete's.  This control is
required for constant frame rate applications.
This commit is contained in:
Robert Osfield
2003-07-15 21:19:03 +00:00
parent 0c4a66c85e
commit 82008d5ecd
13 changed files with 57 additions and 35 deletions

View File

@@ -304,7 +304,7 @@ class SG_EXPORT Drawable : public Object
/** flush all the cached display list which need to be deleted
* in the OpenGL context related to contextID.*/
static void flushDeletedDisplayLists(unsigned int contextID);
static void flushDeletedDisplayLists(unsigned int contextID,double currentTime, double& availableTime);
/** use deleteVertexBufferObject instead of glDeleteList to allow
* OpenGL buffer objects to cached until they can be deleted
@@ -314,7 +314,7 @@ class SG_EXPORT Drawable : public Object
/** flush all the cached vertex buffer objects which need to be deleted
* in the OpenGL context related to contextID.*/
static void flushDeletedVertexBufferObjects(unsigned int contextID);
static void flushDeletedVertexBufferObjects(unsigned int contextID,double currentTime, double& availableTime);
typedef unsigned int AttributeType;

View File

@@ -523,8 +523,12 @@ class SG_EXPORT Texture : public osg::StateAttribute
virtual void addTextureObjectsFrom(Texture& texture);
virtual void deleteTextureObjects(unsigned int contextID,double currentTime);
virtual void flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime);
void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; }
double getExpiryDelay() const { return _expiryDelay; }
// how long to keep unsed texture objects around for before deleting.
double _expiryDelay;
@@ -536,6 +540,7 @@ class SG_EXPORT Texture : public osg::StateAttribute
static void setTextureObjectManager(TextureObjectManager* tom);
static TextureObjectManager* getTextureObjectManager();
static void flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime);

View File

@@ -54,6 +54,9 @@ class SG_EXPORT Timer {
Timer();
~Timer() {}
static const Timer* instance();
#if defined __DARWIN_OSX__ || defined macintosh
// PJA MAC OSX - inline Tick() pollutes namespace so badly
// we cant compile, due to Carbon.h ...

View File

@@ -188,7 +188,7 @@ class SG_EXPORT VertexProgram : public StateAttribute
/** flush all the cached vertex programs which need to be deleted
* in the OpenGL context related to contextID.*/
static void flushDeletedVertexProgramObjects(unsigned int contextID);
static void flushDeletedVertexProgramObjects(unsigned int contextID,double currentTime, double& availableTime);
virtual void apply(State& state) const;

View File

@@ -80,15 +80,9 @@ class OSGPRODUCER_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseReques
/** Get whether the compilation of rendering objects for specfied graphics context on (true) or off(false).*/
bool getCompileRenderingObjectsForContexID(unsigned int contextID);
/* Set the maximum amount of time available for compile rendering objects. */
void setMaximumTimeForCompilingRenderingObjects(double time) { _maximumTimeForCompiling = time; }
/* Get the maximum amount of time available for compile rendering objects. */
double getMaximumTimeForCompilingRenderingObjects() const { return _maximumTimeForCompiling; }
/** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph.
* note, should only be called from the draw thread.*/
void compileRenderingObjects(osg::State& state);
void compileRenderingObjects(osg::State& state,double& availableTime);
public:
@@ -141,7 +135,6 @@ class OSGPRODUCER_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseReques
double _expiryDelay;
double _maximumTimeForCompiling;
ActiveGraphicsContexts _activeGraphicsContexts;
};