Base class for providing Windowing API agnostic access to creating and managing graphics context.
typedef std::list< osg::Camera* > osg::GraphicsContext::Cameras |
typedef std::vector<GraphicsContext*> osg::GraphicsContext::GraphicsContexts |
typedef std::list< ref_ptr<Operation> > osg::GraphicsContext::OperationQueue |
typedef std::vector<ScreenSettings> osg::GraphicsContext::ScreenSettingsList |
osg::GraphicsContext::GraphicsContext | ( | ) | [protected] |
osg::GraphicsContext::GraphicsContext | ( | const GraphicsContext & | , |
const osg::CopyOp & | |||
) | [protected] |
virtual osg::GraphicsContext::~GraphicsContext | ( | ) | [protected, virtual] |
void osg::GraphicsContext::add | ( | Operation * | operation ) |
Add operation to end of OperationQueue.
void osg::GraphicsContext::addCamera | ( | osg::Camera * | camera ) | [protected] |
void osg::GraphicsContext::bindPBufferToTexture | ( | GLenum | buffer ) | [inline] |
Bind the graphics context to associated texture.
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 concrete implementations of GraphicsContext.
Implemented in osgViewer::PixelBufferWin32, osgViewer::PixelBufferX11, and osgViewer::GraphicsWindow.
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 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.
Clone an object, with Object* return type. Must be defined by derived classes.
Implements osg::Object.
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.
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.
virtual void osg::GraphicsContext::closeImplementation | ( | ) | [pure virtual] |
Close the graphics context implementation. Pure virtual - must be implemented by concrete implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
static GraphicsContext* osg::GraphicsContext::createGraphicsContext | ( | Traits * | traits ) | [static] |
Create a graphics context for a specified set of traits.
void osg::GraphicsContext::createGraphicsThread | ( | ) |
Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
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.
Referenced by osgViewer::GraphicsWindowX11::GraphicsWindowX11(), and osgViewer::GraphicsWindowEmbedded::init().
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.
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.
const Vec4& osg::GraphicsContext::getClearColor | ( | ) | const [inline] |
Returns the clear color.
GLbitfield osg::GraphicsContext::getClearMask | ( | ) | const [inline] |
Get the clear mask.
static GraphicsContext* osg::GraphicsContext::getCompileContext | ( | unsigned int | contextID ) | [static] |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
Operation* osg::GraphicsContext::getCurrentOperation | ( | ) | [inline] |
Get the current operations that is being run.
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.
static unsigned int osg::GraphicsContext::getMaxContextID | ( | ) | [static] |
Get the current max ContextID.
osg::RefBlock* osg::GraphicsContext::getOperationsBlock | ( | ) | [inline] |
Get the operations queue block used to mark an empty queue, if you end items into the empty queue you must release this block.
OpenThreads::Mutex* osg::GraphicsContext::getOperationsMutex | ( | ) | [inline] |
Get the operations queue mutex.
OperationQueue& osg::GraphicsContext::getOperationsQueue | ( | ) | [inline] |
Get the operations queue, not you must use the OperationsMutex when accessing the queue.
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 GraphicsContexts osg::GraphicsContext::getRegisteredGraphicsContexts | ( | unsigned int | contextID ) | [static] |
Get all the registered graphics contexts associated with a specific contextID.
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().
State* osg::GraphicsContext::getState | ( | ) | [inline] |
Get the State object which tracks the current OpenGL state for this graphics context.
Referenced by osgViewer::GraphicsWindowEmbedded::init().
const State* osg::GraphicsContext::getState | ( | ) | const [inline] |
Get the const State object which tracks the current OpenGL state for this graphics context.
const Traits* osg::GraphicsContext::getTraits | ( | ) | const [inline] |
Get the traits of the GraphicsContext.
static WindowingSystemInterface* osg::GraphicsContext::getWindowingSystemInterface | ( | ) | [static] |
Get the WindowingSystemInterface
static void osg::GraphicsContext::incrementContextIDUsageCount | ( | unsigned int | contextID ) | [static] |
Increment the usage count associate with a contextID. The usage count specifies how many graphics contexts a specific contextID is shared between.
Referenced by osgViewer::GraphicsWindowEmbedded::init().
bool osg::GraphicsContext::isCurrent | ( | ) | const [inline] |
Return true if the current thread has this OpenGL graphics context.
References OpenThreads::Thread::CurrentThread().
bool osg::GraphicsContext::isRealized | ( | ) | const [inline] |
Return true if the graphics context has been realized and is ready to use.
virtual bool osg::GraphicsContext::isRealizedImplementation | ( | ) | const [pure virtual] |
Return true if the graphics context has been realized, and is ready to use, implementation. Pure virtual - must be implemented by concrete implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
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.
bool osg::GraphicsContext::makeContextCurrent | ( | GraphicsContext * | readContext ) |
Make this graphics context current with specified read context. Implemented by calling makeContextCurrentImplementation(). Returns true on success.
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 concrete implementations of GraphicsContext.
Implemented in osgViewer::PixelBufferX11.
bool osg::GraphicsContext::makeCurrent | ( | ) |
Make this graphics context current. Implemented by calling makeCurrentImplementation(). Returns true on success.
Referenced by osgViewer::ViewerBase::makeCurrent().
virtual bool osg::GraphicsContext::makeCurrentImplementation | ( | ) | [pure virtual] |
Make this graphics context current implementation. Pure virtual - must be implemented by concrete implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
bool osg::GraphicsContext::realize | ( | ) |
Realize the GraphicsContext.
virtual bool osg::GraphicsContext::realizeImplementation | ( | ) | [pure virtual] |
Realize the GraphicsContext implementation, Pure virtual - must be implemented by concrete implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
static void osg::GraphicsContext::registerGraphicsContext | ( | GraphicsContext * | gc ) | [static, protected] |
Register a GraphicsContext.
bool osg::GraphicsContext::releaseContext | ( | ) |
Release the graphics context. Returns true on success.
Referenced by osgViewer::ViewerBase::releaseContext().
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.
void osg::GraphicsContext::remove | ( | const std::string & | name ) |
Remove named operation from OperationQueue.
void osg::GraphicsContext::remove | ( | Operation * | operation ) |
Remove operation from OperationQueue.
void osg::GraphicsContext::removeAllOperations | ( | ) |
Remove all operations from OperationQueue.
void osg::GraphicsContext::removeCamera | ( | osg::Camera * | camera ) | [protected] |
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.
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.
void osg::GraphicsContext::runOperations | ( | ) |
Run the operations.
void osg::GraphicsContext::setClearColor | ( | const Vec4 & | color ) | [inline] |
Sets the clear color.
void osg::GraphicsContext::setClearMask | ( | GLbitfield | mask ) | [inline] |
Set the clear mask used in glClear(..). Defaults to 0 - so no clear is done by default by the GraphicsContext, instead the Camera's attached the GraphicsContext will do the clear. GraphicsContext::setClearMask() is useful for when the Camera's Viewports don't conver the whole context, so the context will fill in the gaps.
static void osg::GraphicsContext::setCompileContext | ( | unsigned int | contextID, |
GraphicsContext * | gc | ||
) | [static] |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
void osg::GraphicsContext::setGraphicsThread | ( | GraphicsThread * | gt ) |
Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
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.
void osg::GraphicsContext::setState | ( | State * | state ) | [inline] |
Set the State object which tracks the current OpenGL state for this graphics context.
Referenced by osgViewer::GraphicsWindowEmbedded::init().
static void osg::GraphicsContext::setWindowingSystemInterface | ( | WindowingSystemInterface * | wsInterface ) | [static] |
Set the query the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit.
void osg::GraphicsContext::swapBuffers | ( | ) |
swap the front and back buffers.
virtual void osg::GraphicsContext::swapBuffersImplementation | ( | ) | [pure virtual] |
Swap the front and back buffers implementation. Pure virtual - must be implemented by concrete implementations of GraphicsContext.
Implemented in osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferX11, osgViewer::GraphicsWindow, and osgViewer::GraphicsWindowEmbedded.
static void osg::GraphicsContext::unregisterGraphicsContext | ( | GraphicsContext * | gc ) | [static, protected] |
Unregister a 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.
Referenced by osgViewer::ViewerBase::makeCurrent().
friend class osg::Camera [friend] |
Cameras osg::GraphicsContext::_cameras [protected] |
Vec4 osg::GraphicsContext::_clearColor [protected] |
GLbitfield osg::GraphicsContext::_clearMask [protected] |
osg::ref_ptr<Operation> osg::GraphicsContext::_currentOperation [protected] |
ref_ptr<GraphicsThread> osg::GraphicsContext::_graphicsThread [protected] |
OperationQueue osg::GraphicsContext::_operations [protected] |
ref_ptr<ResizedCallback> osg::GraphicsContext::_resizedCallback [protected] |
ref_ptr<State> osg::GraphicsContext::_state [protected] |
ref_ptr<Traits> osg::GraphicsContext::_traits [protected] |