Public Types | |
typedef std::vector < GraphicsContext * > | GraphicsContexts |
typedef std::list < ref_ptr< Operation > > | OperationQueue |
typedef std::list < osg::Camera * > | Cameras |
Public Member Functions | |
void | add (Operation *operation) |
Add operation to end of OperationQueue. | |
void | remove (Operation *operation) |
Remove operation from OperationQueue. | |
void | remove (const std::string &name) |
Remove named operation from OperationQueue. | |
void | removeAllOperations () |
Remove all operations from OperationQueue. | |
void | runOperations () |
Run the operations. | |
OperationQueue & | getOperationsQueue () |
Get the operations queue, not you must use the OperationsMutex when accessing the queue. | |
OpenThreads::Mutex * | getOperationsMutex () |
Get the operations queue mutex. | |
osg::RefBlock * | getOperationsBlock () |
Get the operations queue block used to mark an empty queue, if you end items into the empty queu you must release this block. | |
Operation * | getCurrentOperation () |
Get the current operations that is being run. | |
const Traits * | getTraits () const |
Get the traits of the GraphicsContext. | |
virtual bool | valid () const =0 |
Return whether a valid and usable GraphicsContext has been created. | |
void | setState (State *state) |
Set the State object which tracks the current OpenGL state for this graphics context. | |
State * | getState () |
Get the State object which tracks the current OpenGL state for this graphics context. | |
const State * | getState () const |
Get the const State object which tracks the current OpenGL state for this graphics context. | |
void | setClearColor (const Vec4 &color) |
Sets the clear color. | |
const Vec4 & | getClearColor () const |
Returns the clear color. | |
void | setClearMask (GLbitfield mask) |
Set the clear mask used in glClear(. | |
GLbitfield | getClearMask () const |
Get the clear mask. | |
virtual void | clear () |
Do an OpenGL clear of the full graphics context/window. | |
bool | realize () |
Realise the GraphicsContext. | |
void | close (bool callCloseImplementation=true) |
close the graphics context. | |
void | swapBuffers () |
swap the front and back buffers. | |
bool | isRealized () const |
Return true if the graphics context has been realised and is ready to use. | |
bool | makeCurrent () |
Make this graphics context current. | |
bool | makeContextCurrent (GraphicsContext *readContext) |
Make this graphics context current with specified read context. | |
bool | releaseContext () |
Release the graphics context. | |
bool | isCurrent () const |
Return true if the current thread has this OpenGL graphics context. | |
void | bindPBufferToTexture (GLenum buffer) |
Bind the graphics context to associated texture. | |
void | createGraphicsThread () |
Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations. | |
void | setGraphicsThread (GraphicsThread *gt) |
Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations. | |
GraphicsThread * | getGraphicsThread () |
Get the graphics thread assigned the graphics context. | |
const GraphicsThread * | getGraphicsThread () const |
Get the const graphics thread assigned the graphics context. | |
virtual bool | realizeImplementation ()=0 |
Realise the GraphicsContext implementation, Pure virtual - must be implemented by concrate implementations of GraphicsContext. | |
virtual bool | isRealizedImplementation () const =0 |
Return true if the graphics context has been realised, and is ready to use, implementation. | |
virtual void | closeImplementation ()=0 |
Close the graphics context implementation. | |
virtual bool | makeCurrentImplementation ()=0 |
Make this graphics context current implementation. | |
virtual bool | makeContextCurrentImplementation (GraphicsContext *readContext)=0 |
Make this graphics context current with specified read context implementation. | |
virtual bool | releaseContextImplementation ()=0 |
Release the graphics context implementation. | |
virtual void | bindPBufferToTextureImplementation (GLenum buffer)=0 |
Pure virtual, Bind the graphics context to associated texture implementation. | |
virtual void | swapBuffersImplementation ()=0 |
Swap the front and back buffers implementation. | |
void | resized (int x, int y, int width, int height) |
resized method should be called when the underlying window has been resized and the GraphicsWindow and associated Cameras must be updated to keep in sync with the new size. | |
void | setResizedCallback (ResizedCallback *rc) |
Set the resized callback which overrides the GraphicsConext::realizedImplementation(), allow developers to provide custom behavior in response to a window being resized. | |
ResizedCallback * | getResizedCallback () |
Get the resized callback which overrides the GraphicsConext::realizedImplementation(). | |
const ResizedCallback * | getResizedCallback () const |
Get the const resized callback which overrides the GraphicsConext::realizedImplementation(). | |
virtual void | resizedImplementation (int x, int y, int width, int height) |
resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the graphics Window. | |
Cameras & | getCameras () |
Get the the list of cameras associated with this graphics context. | |
const Cameras & | getCameras () const |
Get the the const list of cameras associated with this graphics context. | |
virtual bool | isSameKindAs (const Object *object) const |
virtual const char * | libraryName () const |
return the name of the object's library. | |
virtual const char * | className () const |
return the name of the object's class type. | |
Static Public Member Functions | |
static void | setWindowingSystemInterface (WindowingSystemInterface *wsInterface) |
Set the querry the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit. | |
static WindowingSystemInterface * | getWindowingSystemInterface () |
Get the WindowingSystemInterface. | |
static GraphicsContext * | createGraphicsContext (Traits *traits) |
Create a graphics context for a specified set of traits. | |
static unsigned int | createNewContextID () |
Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context. | |
static unsigned int | getMaxContextID () |
Get the current max ContextID. | |
static void | incrementContextIDUsageCount (unsigned int contextID) |
Increment the usage count associate with a contextID. | |
static void | decrementContextIDUsageCount (unsigned int contextID) |
Decrement the usage count associate with a contextID. | |
static GraphicsContexts | getAllRegisteredGraphicsContexts () |
Get all the registered graphics contexts. | |
static GraphicsContexts | getRegisteredGraphicsContexts (unsigned int contextID) |
Get all the registered graphics contexts associated with a specific contextID. | |
static void | setCompileContext (unsigned int contextID, GraphicsContext *gc) |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID. | |
static GraphicsContext * | getOrCreateCompileContext (unsigned int contextID) |
Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID. | |
static GraphicsContext * | getCompileContext (unsigned int contextID) |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID. | |
Protected Member Functions | |
GraphicsContext () | |
GraphicsContext (const GraphicsContext &, const osg::CopyOp &) | |
virtual | ~GraphicsContext () |
virtual Object * | cloneType () const |
Clone the type of an object, with Object* return type. | |
virtual Object * | clone (const CopyOp &) const |
Clone an object, with Object* return type. | |
void | addCamera (osg::Camera *camera) |
void | removeCamera (osg::Camera *camera) |
Static Protected Member Functions | |
static void | registerGraphicsContext (GraphicsContext *gc) |
Register a GraphicsContext. | |
static void | unregisterGraphicsContext (GraphicsContext *gc) |
Unregister a GraphicsContext. | |
Protected Attributes | |
Cameras | _cameras |
ref_ptr< Traits > | _traits |
ref_ptr< State > | _state |
Vec4 | _clearColor |
GLbitfield | _clearMask |
OpenThreads::Thread * | _threadOfLastMakeCurrent |
OpenThreads::Mutex | _operationsMutex |
osg::ref_ptr < osg::RefBlock > | _operationsBlock |
OperationQueue | _operations |
osg::ref_ptr< Operation > | _currentOperation |
ref_ptr< GraphicsThread > | _graphicsThread |
ref_ptr < ResizedCallback > | _resizedCallback |
Friends | |
class | osg::Camera |
Classes | |
struct | ResizedCallback |
struct | ScreenIdentifier |
struct | Traits |
GraphicsContext Traits object provides the specification of what type of graphics context is required. More... | |
struct | WindowingSystemInterface |
Callback to be implemented to provide access to Windowing API's ability to create Windows/pbuffers. More... |
typedef std::vector<GraphicsContext*> osg::GraphicsContext::GraphicsContexts |
typedef std::list< ref_ptr<Operation> > osg::GraphicsContext::OperationQueue |
typedef std::list< osg::Camera* > osg::GraphicsContext::Cameras |
osg::GraphicsContext::GraphicsContext | ( | ) | [protected] |
osg::GraphicsContext::GraphicsContext | ( | const GraphicsContext & | , | |
const osg::CopyOp & | ||||
) | [protected] |
virtual osg::GraphicsContext::~GraphicsContext | ( | ) | [protected, virtual] |
static void osg::GraphicsContext::setWindowingSystemInterface | ( | WindowingSystemInterface * | wsInterface | ) | [static] |
Set the querry the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit.
static WindowingSystemInterface* osg::GraphicsContext::getWindowingSystemInterface | ( | ) | [static] |
Get the WindowingSystemInterface.
static GraphicsContext* osg::GraphicsContext::createGraphicsContext | ( | Traits * | traits | ) | [static] |
Create a graphics context for a specified set of traits.
static unsigned int osg::GraphicsContext::createNewContextID | ( | ) | [static] |
Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context.
Automatically increments the usage count of the contextID to 1.
static unsigned int osg::GraphicsContext::getMaxContextID | ( | ) | [static] |
Get the current max ContextID.
static void osg::GraphicsContext::incrementContextIDUsageCount | ( | unsigned int | contextID | ) | [static] |
Increment the usage count associate with a contextID.
The usage count speficies how many graphics contexts a specific contextID is shared between.
static void osg::GraphicsContext::decrementContextIDUsageCount | ( | unsigned int | contextID | ) | [static] |
Decrement the usage count associate with a contextID.
Once the contextID goes to 0 the contextID is then free to be reused.
static GraphicsContexts osg::GraphicsContext::getAllRegisteredGraphicsContexts | ( | ) | [static] |
Get all the registered graphics contexts.
static GraphicsContexts osg::GraphicsContext::getRegisteredGraphicsContexts | ( | unsigned int | contextID | ) | [static] |
Get all the registered graphics contexts associated with a specific contextID.
static void osg::GraphicsContext::setCompileContext | ( | unsigned int | contextID, | |
GraphicsContext * | gc | |||
) | [static] |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
static GraphicsContext* osg::GraphicsContext::getOrCreateCompileContext | ( | unsigned int | contextID | ) | [static] |
Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID.
static GraphicsContext* osg::GraphicsContext::getCompileContext | ( | unsigned int | contextID | ) | [static] |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
void osg::GraphicsContext::add | ( | Operation * | operation | ) |
Add operation to end of OperationQueue.
void osg::GraphicsContext::remove | ( | Operation * | operation | ) |
Remove operation from OperationQueue.
void osg::GraphicsContext::remove | ( | const std::string & | name | ) |
Remove named operation from OperationQueue.
void osg::GraphicsContext::removeAllOperations | ( | ) |
Remove all operations from OperationQueue.
void osg::GraphicsContext::runOperations | ( | ) |
Run the operations.
OperationQueue& osg::GraphicsContext::getOperationsQueue | ( | ) | [inline] |
Get the operations queue, not you must use the OperationsMutex when accessing the queue.
OpenThreads::Mutex* osg::GraphicsContext::getOperationsMutex | ( | ) | [inline] |
Get the operations queue mutex.
osg::RefBlock* osg::GraphicsContext::getOperationsBlock | ( | ) | [inline] |
Get the operations queue block used to mark an empty queue, if you end items into the empty queu you must release this block.
Operation* osg::GraphicsContext::getCurrentOperation | ( | ) | [inline] |
Get the current operations that is being run.
const Traits* osg::GraphicsContext::getTraits | ( | ) | const [inline] |
Get the traits of the GraphicsContext.
virtual bool osg::GraphicsContext::valid | ( | ) | const [pure virtual] |
Return whether a valid and usable GraphicsContext has been created.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
void osg::GraphicsContext::setState | ( | State * | state | ) | [inline] |
Set the State object which tracks the current OpenGL state for this graphics context.
State* osg::GraphicsContext::getState | ( | ) | [inline] |
Get the State object which tracks the current OpenGL state for this graphics context.
const State* osg::GraphicsContext::getState | ( | ) | const [inline] |
Get the const State object which tracks the current OpenGL state for this graphics context.
void osg::GraphicsContext::setClearColor | ( | const Vec4 & | color | ) | [inline] |
Sets the clear color.
const Vec4& osg::GraphicsContext::getClearColor | ( | ) | const [inline] |
Returns the clear color.
void osg::GraphicsContext::setClearMask | ( | GLbitfield | mask | ) | [inline] |
Set the clear mask used in glClear(.
.). Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT.
GLbitfield osg::GraphicsContext::getClearMask | ( | ) | const [inline] |
Get the clear mask.
virtual void osg::GraphicsContext::clear | ( | ) | [virtual] |
Do an OpenGL clear of the full graphics context/window.
Note, must only be called from a thread with this context current.
bool osg::GraphicsContext::realize | ( | ) |
Realise the GraphicsContext.
void osg::GraphicsContext::close | ( | bool | callCloseImplementation = true |
) |
close the graphics context.
close(bool) stops any associated graphics threads, releases the contextID for the GraphicsContext then optional calls closeImplementation() to do the actual deletion of the graphics. This call is made optional as there are times when the graphics context has already been deleted externally and only the OSG side of the its data need to be closed down.
void osg::GraphicsContext::swapBuffers | ( | ) |
swap the front and back buffers.
bool osg::GraphicsContext::isRealized | ( | ) | const [inline] |
Return true if the graphics context has been realised and is ready to use.
bool osg::GraphicsContext::makeCurrent | ( | ) |
Make this graphics context current.
Implementated by calling makeCurrentImplementation(). Returns true on success.
bool osg::GraphicsContext::makeContextCurrent | ( | GraphicsContext * | readContext | ) |
Make this graphics context current with specified read context.
Implementated by calling makeContextCurrentImplementation(). Returns true on success.
bool osg::GraphicsContext::releaseContext | ( | ) |
Release the graphics context.
Returns true on success.
bool osg::GraphicsContext::isCurrent | ( | ) | const [inline] |
Return true if the current thread has this OpenGL graphics context.
void osg::GraphicsContext::bindPBufferToTexture | ( | GLenum | buffer | ) | [inline] |
Bind the graphics context to associated texture.
void osg::GraphicsContext::createGraphicsThread | ( | ) |
Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
void osg::GraphicsContext::setGraphicsThread | ( | GraphicsThread * | gt | ) |
Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
GraphicsThread* osg::GraphicsContext::getGraphicsThread | ( | ) | [inline] |
Get the graphics thread assigned the graphics context.
const GraphicsThread* osg::GraphicsContext::getGraphicsThread | ( | ) | const [inline] |
Get the const graphics thread assigned the graphics context.
virtual bool osg::GraphicsContext::realizeImplementation | ( | ) | [pure virtual] |
Realise the GraphicsContext implementation, Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual bool osg::GraphicsContext::isRealizedImplementation | ( | ) | const [pure virtual] |
Return true if the graphics context has been realised, and is ready to use, implementation.
Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual void osg::GraphicsContext::closeImplementation | ( | ) | [pure virtual] |
Close the graphics context implementation.
Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual bool osg::GraphicsContext::makeCurrentImplementation | ( | ) | [pure virtual] |
Make this graphics context current implementation.
Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual bool osg::GraphicsContext::makeContextCurrentImplementation | ( | GraphicsContext * | readContext | ) | [pure virtual] |
Make this graphics context current with specified read context implementation.
Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::PixelBufferX11.
virtual bool osg::GraphicsContext::releaseContextImplementation | ( | ) | [pure virtual] |
Release the graphics context implementation.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual void osg::GraphicsContext::bindPBufferToTextureImplementation | ( | GLenum | buffer | ) | [pure virtual] |
Pure virtual, Bind the graphics context to associated texture implementation.
Pure virtual - must be implemented by concrate implementations of GraphicsContext.
Implemented in osgViewer::PixelBufferWin32, osgViewer::PixelBufferX11, and osgViewer::GraphicsWindow.
virtual void osg::GraphicsContext::swapBuffersImplementation | ( | ) | [pure virtual] |
Swap the front and back buffers implementation.
Pure virtual - must be implemented by Concrate implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
void osg::GraphicsContext::resized | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) | [inline] |
resized method should be called when the underlying window has been resized and the GraphicsWindow and associated Cameras must be updated to keep in sync with the new size.
void osg::GraphicsContext::setResizedCallback | ( | ResizedCallback * | rc | ) | [inline] |
Set the resized callback which overrides the GraphicsConext::realizedImplementation(), allow developers to provide custom behavior in response to a window being resized.
ResizedCallback* osg::GraphicsContext::getResizedCallback | ( | ) | [inline] |
Get the resized callback which overrides the GraphicsConext::realizedImplementation().
const ResizedCallback* osg::GraphicsContext::getResizedCallback | ( | ) | const [inline] |
Get the const resized callback which overrides the GraphicsConext::realizedImplementation().
virtual void osg::GraphicsContext::resizedImplementation | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) | [virtual] |
resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the graphics Window.
Cameras& osg::GraphicsContext::getCameras | ( | ) | [inline] |
Get the the list of cameras associated with this graphics context.
const Cameras& osg::GraphicsContext::getCameras | ( | ) | const [inline] |
Get the the const list of cameras associated with this graphics context.
virtual bool osg::GraphicsContext::isSameKindAs | ( | const Object * | object | ) | const [inline, virtual] |
Reimplemented from osg::Object.
virtual const char* osg::GraphicsContext::libraryName | ( | ) | const [inline, virtual] |
return the name of the object's library.
Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.
Implements osg::Object.
Reimplemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual const char* osg::GraphicsContext::className | ( | ) | const [inline, virtual] |
return the name of the object's class type.
Must be defined by derived classes.
Implements osg::Object.
Reimplemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
virtual Object* osg::GraphicsContext::cloneType | ( | ) | const [inline, protected, virtual] |
Clone the type of an object, with Object* return type.
Must be defined by derived classes.
Implements osg::Object.
Clone an object, with Object* return type.
Must be defined by derived classes.
Implements osg::Object.
static void osg::GraphicsContext::registerGraphicsContext | ( | GraphicsContext * | gc | ) | [static, protected] |
Register a GraphicsContext.
static void osg::GraphicsContext::unregisterGraphicsContext | ( | GraphicsContext * | gc | ) | [static, protected] |
Unregister a GraphicsContext.
void osg::GraphicsContext::addCamera | ( | osg::Camera * | camera | ) | [protected] |
void osg::GraphicsContext::removeCamera | ( | osg::Camera * | camera | ) | [protected] |
friend class osg::Camera [friend] |
Cameras osg::GraphicsContext::_cameras [protected] |
ref_ptr<Traits> osg::GraphicsContext::_traits [protected] |
ref_ptr<State> osg::GraphicsContext::_state [protected] |
Vec4 osg::GraphicsContext::_clearColor [protected] |
GLbitfield osg::GraphicsContext::_clearMask [protected] |
OpenThreads::Thread* osg::GraphicsContext::_threadOfLastMakeCurrent [protected] |
OpenThreads::Mutex osg::GraphicsContext::_operationsMutex [protected] |
OperationQueue osg::GraphicsContext::_operations [protected] |
osg::ref_ptr<Operation> osg::GraphicsContext::_currentOperation [protected] |
ref_ptr<GraphicsThread> osg::GraphicsContext::_graphicsThread [protected] |
ref_ptr<ResizedCallback> osg::GraphicsContext::_resizedCallback [protected] |