GraphicsThread
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_GRAPHICSTHREAD
#define OSG_GRAPHICSTHREAD 1
#include <osg/OperationThread>
#include <osg/State>
namespace osg {
class GraphicsContext;
class OSG_EXPORT GraphicsThread : public osg::OperationThread
{
public:
GraphicsThread();
virtual void run();
};
struct OSG_EXPORT GraphicsOperation : public Operation
{
GraphicsOperation(const std::string& name, bool keep):
Operation(name,keep) {}
virtual void operator () (Object* object);
virtual void operator () (GraphicsContext* context) = 0;
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
virtual void releaseGLObjects(osg::State* = 0) const {}
};
struct OSG_EXPORT SwapBuffersOperation : public GraphicsOperation
{
SwapBuffersOperation():
osg::Referenced(true),
GraphicsOperation("SwapBuffers",true) {}
virtual void operator () (GraphicsContext* context);
};
struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barrier
{
enum PreBlockOp
{
NO_OPERATION,
GL_FLUSH,
GL_FINISH
};
BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true):
osg::Referenced(true),
Operation("Barrier", keep),
OpenThreads::Barrier(numThreads),
_preBlockOp(op) {}
virtual void release();
virtual void operator () (Object* object);
PreBlockOp _preBlockOp;
};
struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public RefBlock
{
ReleaseContext_Block_MakeCurrentOperation():
osg::Referenced(true),
GraphicsOperation("ReleaseContext_Block_MakeCurrent", false) {}
virtual void release();
virtual void operator () (GraphicsContext* context);
};
struct OSG_EXPORT BlockAndFlushOperation : public GraphicsOperation, public OpenThreads::Block
{
BlockAndFlushOperation();
virtual void release();
virtual void operator () (GraphicsContext*);
};
struct OSG_EXPORT FlushDeletedGLObjectsOperation : public GraphicsOperation
{
FlushDeletedGLObjectsOperation(double availableTime, bool keep=false);
virtual void operator () (GraphicsContext*);
double _availableTime;
};
class OSG_EXPORT RunOperations : public osg::GraphicsOperation
{
public:
RunOperations():
osg::GraphicsOperation("RunOperation",true) {}
virtual void operator () (osg::GraphicsContext* context);
};
class OSG_EXPORT EndOfDynamicDrawBlock : public OpenThreads::BlockCount, public osg::State::DynamicObjectRenderingCompletedCallback
{
public:
EndOfDynamicDrawBlock(unsigned int);
void completed(osg::State* state);
protected:
~EndOfDynamicDrawBlock() {}
};
}
#endif
OperationThread
State
OpenThreads::Barrier
This class provides an object-oriented thread barrier interface.
Definition Barrier:37
OpenThreads::Barrier::Barrier
Barrier(int numThreads=0)
OpenThreads::BlockCount
Definition Block:101
OpenThreads::Block
Definition Block:26
osg::EndOfDynamicDrawBlock::EndOfDynamicDrawBlock
EndOfDynamicDrawBlock(unsigned int)
osg::EndOfDynamicDrawBlock::completed
void completed(osg::State *state)
osg::EndOfDynamicDrawBlock::~EndOfDynamicDrawBlock
~EndOfDynamicDrawBlock()
Definition GraphicsThread:142
osg::GraphicsContext
Definition GraphicsContext:30
osg::GraphicsThread::GraphicsThread
GraphicsThread()
osg::GraphicsThread::run
virtual void run()
osg::Object
Definition Object:61
osg::OperationThread
Definition OperationThread:154
osg::Operation::Operation
Operation(const std::string &name, bool keep)
Definition OperationThread:54
osg::RefBlock::RefBlock
RefBlock()
Definition OperationThread:34
osg::Referenced
Definition Referenced:44
osg::RunOperations::RunOperations
RunOperations()
Definition GraphicsThread:125
osg::State
Definition State:80
OpenThreads
Definition Affinity:26
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39
osg::BarrierOperation::PreBlockOp
PreBlockOp
Definition GraphicsThread:70
osg::BarrierOperation::GL_FINISH
@ GL_FINISH
Definition GraphicsThread:73
osg::BarrierOperation::NO_OPERATION
@ NO_OPERATION
Definition GraphicsThread:71
osg::BarrierOperation::GL_FLUSH
@ GL_FLUSH
Definition GraphicsThread:72
osg::BarrierOperation::BarrierOperation
BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true)
Definition GraphicsThread:76
osg::BarrierOperation::release
virtual void release()
osg::BarrierOperation::_preBlockOp
PreBlockOp _preBlockOp
Definition GraphicsThread:86
osg::BlockAndFlushOperation::BlockAndFlushOperation
BlockAndFlushOperation()
osg::BlockAndFlushOperation::release
virtual void release()
osg::FlushDeletedGLObjectsOperation::_availableTime
double _availableTime
Definition GraphicsThread:118
osg::FlushDeletedGLObjectsOperation::FlushDeletedGLObjectsOperation
FlushDeletedGLObjectsOperation(double availableTime, bool keep=false)
osg::GraphicsOperation
Definition GraphicsThread:36
osg::GraphicsOperation::releaseGLObjects
virtual void releaseGLObjects(osg::State *=0) const
Definition GraphicsThread:52
osg::GraphicsOperation::resizeGLObjectBuffers
virtual void resizeGLObjectBuffers(unsigned int)
Definition GraphicsThread:47
osg::GraphicsOperation::GraphicsOperation
GraphicsOperation(const std::string &name, bool keep)
Definition GraphicsThread:37
osg::ReleaseContext_Block_MakeCurrentOperation::release
virtual void release()
osg::ReleaseContext_Block_MakeCurrentOperation::ReleaseContext_Block_MakeCurrentOperation
ReleaseContext_Block_MakeCurrentOperation()
Definition GraphicsThread:93
osg::State::DynamicObjectRenderingCompletedCallback
Definition State:860
osg::SwapBuffersOperation::SwapBuffersOperation
SwapBuffersOperation()
Definition GraphicsThread:59