Added FlushDeletedGLObjectsOperation.

This commit is contained in:
Robert Osfield
2007-07-23 16:42:25 +00:00
parent ff267d1ad6
commit 3eae87854b
2 changed files with 27 additions and 0 deletions

View File

@@ -96,6 +96,16 @@ struct OSG_EXPORT BlockAndFlushOperation : public GraphicsOperation, public Open
virtual void operator () (GraphicsContext*);
};
struct OSG_EXPORT FlushDeletedGLObjectsOperation : public GraphicsOperation
{
FlushDeletedGLObjectsOperation(double availableTime, bool keep=false);
virtual void operator () (GraphicsContext*);
double _availableTime;
};
}
#endif

View File

@@ -14,6 +14,7 @@
#include <osg/GraphicsThread>
#include <osg/GraphicsContext>
#include <osg/GLObjects>
#include <osg/Notify>
using namespace osg;
@@ -110,3 +111,19 @@ void BlockAndFlushOperation::operator () (GraphicsContext*)
glFlush();
Block::release();
}
FlushDeletedGLObjectsOperation::FlushDeletedGLObjectsOperation(double availableTime, bool keep):
GraphicsOperation("FlushDeletedGLObjectsOperation",keep)
{
}
void FlushDeletedGLObjectsOperation::operator () (GraphicsContext* context)
{
State* state = context->getState();
unsigned int contextID = state ? state->getContextID() : 0;
const FrameStamp* frameStamp = state ? state->getFrameStamp() : 0;
double currentTime = frameStamp ? frameStamp->getReferenceTime() : 0.0;
double availableTime = _availableTime;
flushDeletedGLObjects(contextID, currentTime, availableTime);
}