Introduce GraphicsOperation subclass from osg::Operation, and osgUtil::GLObjectOperation

for compiling subgraphs.
This commit is contained in:
Robert Osfield
2007-07-13 17:25:35 +00:00
parent 65156475f6
commit a28588a84c
9 changed files with 99 additions and 57 deletions

View File

@@ -41,35 +41,16 @@ void GraphicsThread::run()
}
struct BlockOperation : public Operation, public Block
void GraphicsOperation::operator () (Object* object)
{
BlockOperation():
Operation("Block",false)
{
reset();
}
virtual void release()
{
Block::release();
}
virtual void operator () (Object*)
{
glFlush();
Block::release();
}
};
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
if (context) operator() (context);
}
void SwapBuffersOperation::operator () (Object* object)
void SwapBuffersOperation::operator () (GraphicsContext* context)
{
GraphicsContext* context = dynamic_cast<GraphicsContext*>(object);
if (context)
{
context->swapBuffersImplementation();
context->clear();
}
context->swapBuffersImplementation();
context->clear();
}
void BarrierOperation::release()
@@ -77,7 +58,7 @@ void BarrierOperation::release()
Barrier::release();
}
void BarrierOperation::operator () (Object*)
void BarrierOperation::operator () (GraphicsContext*)
{
if (_preBlockOp==GL_FLUSH) glFlush();
if (_preBlockOp==GL_FINISH) glFinish();
@@ -91,11 +72,8 @@ void ReleaseContext_Block_MakeCurrentOperation::release()
}
void ReleaseContext_Block_MakeCurrentOperation::operator () (Object* object)
void ReleaseContext_Block_MakeCurrentOperation::operator () (GraphicsContext* context)
{
GraphicsContext* context = dynamic_cast<GraphicsContext*>(object);
if (!context) return;
// release the graphics context.
context->releaseContext();
@@ -111,7 +89,7 @@ void ReleaseContext_Block_MakeCurrentOperation::operator () (Object* object)
BlockAndFlushOperation::BlockAndFlushOperation():
Operation("Block",false)
GraphicsOperation("Block",false)
{
reset();
}
@@ -121,7 +99,7 @@ void BlockAndFlushOperation::release()
Block::release();
}
void BlockAndFlushOperation::operator () (Object*)
void BlockAndFlushOperation::operator () (GraphicsContext*)
{
glFlush();
Block::release();