osg::GraphicsContext Class Referenceabstract

`#include <GraphicsContext>`

Inheritance diagram for osg::GraphicsContext:

## Classes

struct | ScreenIdentifier
struct | Traits
struct | ScreenSettings
struct | WindowingSystemInterface
class | WindowingSystemInterfaces
struct | SwapCallback
struct | ResizedCallback

## Public Types

typedef std::vector< ScreenSettings > | ScreenSettingsList
typedef std::vector< GraphicsContext * > | GraphicsContexts
typedef std::list< ref_ptr< Operation > > | GraphicsOperationQueue
typedef std::list< osg::Camera * > | Cameras
Public Types inherited from osg::Object
enum | DataVariance { DYNAMIC , STATIC , UNSPECIFIED }

## Public Member Functions

void | add (Operation *operation)
void | remove (Operation *operation)
void | remove (const std::string &name)
void | removeAllOperations ()
virtual void | runOperations ()
GraphicsOperationQueue & | getOperationsQueue ()
OpenThreads::Mutex * | getOperationsMutex ()
osg::RefBlock * | getOperationsBlock ()
Operation * | getCurrentOperation ()
const Traits * | getTraits () const
virtual bool | valid () const =0
void | setState (State *state)
State * | getState ()
const State * | getState () const
void | setClearColor (const Vec4 &color)
const Vec4 & | getClearColor () const
void | setClearMask (GLbitfield mask)
GLbitfield | getClearMask () const
virtual void | clear ()
double | getTimeSinceLastClear () const
bool | realize ()
void | close (bool callCloseImplementation=true)
void | swapBuffers ()
bool | isRealized () const
bool | makeCurrent ()
bool | makeContextCurrent (GraphicsContext *readContext)
bool | releaseContext ()
bool | isCurrent () const
void | bindPBufferToTexture (GLenum buffer)
void | createGraphicsThread ()
void | setGraphicsThread (GraphicsThread *gt)
GraphicsThread * | getGraphicsThread ()
const GraphicsThread * | getGraphicsThread () const
virtual bool | realizeImplementation ()=0
virtual bool | isRealizedImplementation () const =0
virtual void | closeImplementation ()=0
virtual bool | makeCurrentImplementation ()=0
virtual bool | makeContextCurrentImplementation (GraphicsContext *readContext)=0
virtual bool | releaseContextImplementation ()=0
virtual void | bindPBufferToTextureImplementation (GLenum buffer)=0
void | setSwapCallback (SwapCallback *rc)
SwapCallback * | getSwapCallback ()
const SwapCallback * | getSwapCallback () const
void | swapBuffersCallbackOrImplementation ()
virtual void | swapBuffersImplementation ()=0
void | resized (int x, int y, int width, int height)
void | setResizedCallback (ResizedCallback *rc)
ResizedCallback * | getResizedCallback ()
const ResizedCallback * | getResizedCallback () const
virtual void | resizedImplementation (int x, int y, int width, int height)
Cameras & | getCameras ()
const Cameras & | getCameras () const
void | setDefaultFboId (GLuint i)
GLuint | getDefaultFboId () const
virtual bool | isSameKindAs (const Object *object) const
virtual const char * | libraryName () const
virtual const char * | className () const
Public Member Functions inherited from osg::Object
| Object ()
| Object (bool threadSafeRefUnref)
| Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
std::string | getCompoundClassName () const
virtual Node * | asNode ()
virtual const Node * | asNode () const
virtual NodeVisitor * | asNodeVisitor ()
virtual const NodeVisitor * | asNodeVisitor () const
virtual StateSet * | asStateSet ()
virtual const StateSet * | asStateSet () const
virtual StateAttribute * | asStateAttribute ()
virtual const StateAttribute * | asStateAttribute () const
virtual Uniform * | asUniform ()
virtual const Uniform * | asUniform () const
virtual Camera * | asCamera ()
virtual const Camera * | asCamera () const
virtual Drawable * | asDrawable ()
virtual const Drawable * | asDrawable () const
virtual Callback * | asCallback ()
virtual const Callback * | asCallback () const
virtual CallbackObject * | asCallbackObject ()
virtual const CallbackObject * | asCallbackObject () const
virtual UserDataContainer * | asUserDataContainer ()
virtual const UserDataContainer * | asUserDataContainer () const
virtual ValueObject * | asValueObject ()
virtual const ValueObject * | asValueObject () const
virtual Image * | asImage ()
virtual const Image * | asImage () const
virtual void | setThreadSafeRefUnref (bool threadSafe)
virtual void | setName (const std::string &name)
void | setName (const char *name)
const std::string & | getName () const
void | setDataVariance (DataVariance dv)
DataVariance | getDataVariance () const
virtual void | computeDataVariance ()
void | setUserDataContainer (osg::UserDataContainer *udc)
template<class T>
void | setUserDataContainer (const ref_ptr< T > &udc)
osg::UserDataContainer * | getUserDataContainer ()
const osg::UserDataContainer * | getUserDataContainer () const
osg::UserDataContainer * | getOrCreateUserDataContainer ()
virtual void | setUserData (Referenced *obj)
template<class T>
void | setUserData (const ref_ptr< T > &ud)
virtual Referenced * | getUserData ()
virtual const Referenced * | getUserData () const
template<typename T>
bool | getUserValue (const std::string &name, T &value) const
template<typename T>
void | setUserValue (const std::string &name, const T &value)
virtual void | resizeGLObjectBuffers (unsigned int)
virtual void | releaseGLObjects (osg::State *=0) const
template<typename T>
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject BoundingBoxdValueObject BoundingSpheredValueObject bool | getUserValue (const std::string &name, T &value) const
Public Member Functions inherited from osg::Referenced
| Referenced ()
| Referenced (bool threadSafeRefUnref)
| Referenced (const Referenced &)
Referenced & | operator= (const Referenced &)
bool | getThreadSafeRefUnref () const
OpenThreads::Mutex * | getRefMutex () const
int | ref () const
int | unref () const
int | unref_nodelete () const
int | referenceCount () const
ObserverSet * | getObserverSet () const
ObserverSet * | getOrCreateObserverSet () const
void | addObserver (Observer *observer) const
void | removeObserver (Observer *observer) const

## Static Public Member Functions

static osg::ref_ptr< WindowingSystemInterfaces > & | getWindowingSystemInterfaces ()
static WindowingSystemInterface * | getWindowingSystemInterface (const std::string &name="")
static GraphicsContext * | createGraphicsContext (Traits *traits)
static unsigned int | createNewContextID ()
static unsigned int | getMaxContextID ()
static void | incrementContextIDUsageCount (unsigned int contextID)
static void | decrementContextIDUsageCount (unsigned int contextID)
static GraphicsContexts | getAllRegisteredGraphicsContexts ()
static GraphicsContexts | getRegisteredGraphicsContexts (unsigned int contextID)
static void | setCompileContext (unsigned int contextID, GraphicsContext *gc)
static GraphicsContext * | getOrCreateCompileContext (unsigned int contextID)
static GraphicsContext * | getCompileContext (unsigned int contextID)
Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * | getGlobalReferencedMutex ()
static void | setDeleteHandler (DeleteHandler *handler)
static DeleteHandler * | getDeleteHandler ()

## Protected Member Functions

| GraphicsContext ()
| GraphicsContext (const GraphicsContext &, const osg::CopyOp &)
virtual | ~GraphicsContext ()
virtual Object * | cloneType () const
virtual Object * | clone (const CopyOp &) const
void | addCamera (osg::Camera *camera)
void | removeCamera (osg::Camera *camera)
Protected Member Functions inherited from osg::Object
virtual | ~Object ()
Protected Member Functions inherited from osg::Referenced
virtual | ~Referenced ()
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const
void | deleteUsingDeleteHandler () const

## Static Protected Member Functions

static void | registerGraphicsContext (GraphicsContext *gc)
static void | unregisterGraphicsContext (GraphicsContext *gc)

## Protected Attributes

Cameras | _cameras
ref_ptr< Traits > | _traits
ref_ptr< State > | _state
Vec4 | _clearColor
GLbitfield | _clearMask
size_t | _threadOfLastMakeCurrent
OpenThreads::Mutex | _operationsMutex
osg::ref_ptr< osg::RefBlock > | _operationsBlock
GraphicsOperationQueue | _operations
osg::ref_ptr< Operation > | _currentOperation
ref_ptr< GraphicsThread > | _graphicsThread
ref_ptr< ResizedCallback > | _resizedCallback
ref_ptr< SwapCallback > | _swapCallback
Timer_t | _lastClearTick
GLuint | _defaultFboId
Protected Attributes inherited from osg::Object
std::string | _name
DataVariance | _dataVariance
osg::UserDataContainer * | _userDataContainer
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr | _observerSet
OpenThreads::Atomic | _refCount

## Friends

class | osg::Camera

## Detailed Description

Base class for providing Windowing API agnostic access to creating and managing graphics context.

## Member Typedef Documentation

## Cameras

typedef std::list< osg::Camera* > osg::GraphicsContext::Cameras

## GraphicsContexts

typedef std::vector<GraphicsContext*> osg::GraphicsContext::GraphicsContexts

## GraphicsOperationQueue

typedef std::list< ref_ptr<Operation> > osg::GraphicsContext::GraphicsOperationQueue

## ScreenSettingsList

typedef std::vector<ScreenSettings> osg::GraphicsContext::ScreenSettingsList

## Constructor & Destructor Documentation

## GraphicsContext() [1/2]

osg::GraphicsContext::GraphicsContext | ( |  | ) |

protected

Referenced by createGraphicsContext(), osg::GraphicsContext::WindowingSystemInterface::createGraphicsContext(), getCompileContext(), getOrCreateCompileContext(), GraphicsContext(), isSameKindAs(), makeContextCurrent(), makeContextCurrentImplementation(), osgViewer::GraphicsWindow::makeContextCurrentImplementation(), osgViewer::PixelBufferWin32::makeContextCurrentImplementation(), registerGraphicsContext(), osg::GraphicsContext::ResizedCallback::resizedImplementation(), setCompileContext(), osg::GraphicsContext::SwapCallback::swapBuffersImplementation(), and unregisterGraphicsContext().

## GraphicsContext() [2/2]

osg::GraphicsContext::GraphicsContext | ( | const GraphicsContext & | ,
|  | const osg::CopyOp & | )

protected

References GraphicsContext().

## ~GraphicsContext()

virtual osg::GraphicsContext::~GraphicsContext | ( |  | ) |

protected virtual

## Member Function Documentation

## add()

void osg::GraphicsContext::add | ( | Operation * | operation | ) |

Add operation to end of OperationQueue.

## addCamera()

void osg::GraphicsContext::addCamera | ( | osg::Camera * | camera | ) |

protected

## bindPBufferToTexture()

void osg::GraphicsContext::bindPBufferToTexture | ( | GLenum | buffer | ) |

inline

Bind the graphics context to associated texture.

References bindPBufferToTextureImplementation().

## bindPBufferToTextureImplementation()

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::GraphicsWindow, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

Referenced by bindPBufferToTexture().

## className()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## clear()

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()

virtual Object * osg::GraphicsContext::clone | ( | const CopyOp & |  | ) | const

inline protected virtual

Clone an object, with Object* return type. Must be defined by derived classes.

Implements osg::Object.

References osg::Object::Object().

## cloneType()

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.

References osg::Object::Object().

## close()

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.

## closeImplementation()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## createGraphicsContext()

GraphicsContext * osg::GraphicsContext::createGraphicsContext | ( | Traits * | traits | ) |

static

Create a graphics context for a specified set of traits.

References GraphicsContext().

## createGraphicsThread()

void osg::GraphicsContext::createGraphicsThread | ( |  | ) |

Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

## createNewContextID()

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().

## decrementContextIDUsageCount()

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.

## getAllRegisteredGraphicsContexts()

GraphicsContexts osg::GraphicsContext::getAllRegisteredGraphicsContexts | ( |  | ) |

static

Get all the registered graphics contexts.

## getCameras() [1/2]

Cameras & osg::GraphicsContext::getCameras | ( |  | ) |

inline

Get the list of cameras associated with this graphics context.

References _cameras.

## getCameras() [2/2]

const Cameras & osg::GraphicsContext::getCameras | ( |  | ) | const

inline

Get the const list of cameras associated with this graphics context.

References _cameras.

## getClearColor()

const Vec4 & osg::GraphicsContext::getClearColor | ( |  | ) | const

inline

Returns the clear color.

References _clearColor.

## getClearMask()

GLbitfield osg::GraphicsContext::getClearMask | ( |  | ) | const

inline

Get the clear mask.

References _clearMask.

## getCompileContext()

GraphicsContext * osg::GraphicsContext::getCompileContext | ( | unsigned int | contextID | ) |

static

Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.

References GraphicsContext().

## getCurrentOperation()

Operation * osg::GraphicsContext::getCurrentOperation | ( |  | ) |

inline

Get the current operations that is being run.

References _currentOperation.

## getDefaultFboId()

GLuint osg::GraphicsContext::getDefaultFboId | ( |  | ) | const

inline

References _defaultFboId.

## getGraphicsThread() [1/2]

GraphicsThread * osg::GraphicsContext::getGraphicsThread | ( |  | ) |

inline

Get the graphics thread assigned the graphics context.

References _graphicsThread.

## getGraphicsThread() [2/2]

const GraphicsThread * osg::GraphicsContext::getGraphicsThread | ( |  | ) | const

inline

Get the const graphics thread assigned the graphics context.

References _graphicsThread.

## getMaxContextID()

unsigned int osg::GraphicsContext::getMaxContextID | ( |  | ) |

static

Get the current max ContextID.

## getOperationsBlock()

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.

References _operationsBlock.

## getOperationsMutex()

OpenThreads::Mutex * osg::GraphicsContext::getOperationsMutex | ( |  | ) |

inline

Get the operations queue mutex.

References _operationsMutex.

## getOperationsQueue()

GraphicsOperationQueue & osg::GraphicsContext::getOperationsQueue | ( |  | ) |

inline

Get the operations queue, note you must use the OperationsMutex when accessing the queue.

References _operations.

## getOrCreateCompileContext()

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.

References GraphicsContext().

## getRegisteredGraphicsContexts()

GraphicsContexts osg::GraphicsContext::getRegisteredGraphicsContexts | ( | unsigned int | contextID | ) |

static

Get all the registered graphics contexts associated with a specific contextID.

## getResizedCallback() [1/2]

ResizedCallback * osg::GraphicsContext::getResizedCallback | ( |  | ) |

inline

Get the resized callback which overrides the GraphicsConext::realizedImplementation().

References _resizedCallback.

## getResizedCallback() [2/2]

const ResizedCallback * osg::GraphicsContext::getResizedCallback | ( |  | ) | const

inline

Get the const resized callback which overrides the GraphicsConext::realizedImplementation().

References _resizedCallback.

## getState() [1/2]

State * osg::GraphicsContext::getState | ( |  | ) |

inline

Get the State object which tracks the current OpenGL state for this graphics context.

References _state.

Referenced by osgViewer::GraphicsWindowX11::GraphicsWindowX11(), and osgViewer::GraphicsWindowEmbedded::init().

## getState() [2/2]

const State * osg::GraphicsContext::getState | ( |  | ) | const

inline

Get the const State object which tracks the current OpenGL state for this graphics context.

References _state.

## getSwapCallback() [1/2]

SwapCallback * osg::GraphicsContext::getSwapCallback | ( |  | ) |

inline

Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().

References _swapCallback.

## getSwapCallback() [2/2]

const SwapCallback * osg::GraphicsContext::getSwapCallback | ( |  | ) | const

inline

Get the const swap callback which overrides the GraphicsContext::swapBuffersImplementation().

References _swapCallback.

## getTimeSinceLastClear()

double osg::GraphicsContext::getTimeSinceLastClear | ( |  | ) | const

inline

References _lastClearTick, osg::Timer::delta_s(), and osg::Timer::instance().

## getTraits()

const Traits * osg::GraphicsContext::getTraits | ( |  | ) | const

inline

Get the traits of the GraphicsContext.

References _traits.

## getWindowingSystemInterface()

WindowingSystemInterface * osg::GraphicsContext::getWindowingSystemInterface | ( | const std::string & | name = "" | ) |

static

Get the default WindowingSystemInterface for this OS

## getWindowingSystemInterfaces()

osg::ref_ptr< WindowingSystemInterfaces > & osg::GraphicsContext::getWindowingSystemInterfaces | ( |  | ) |

static

Referenced by osg::WindowingSystemInterfaceProxy< T >::WindowingSystemInterfaceProxy(), and osg::WindowingSystemInterfaceProxy< T >::~WindowingSystemInterfaceProxy().

## incrementContextIDUsageCount()

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::GraphicsWindowX11::GraphicsWindowX11(), and osgViewer::GraphicsWindowEmbedded::init().

## isCurrent()

bool osg::GraphicsContext::isCurrent | ( |  | ) | const

inline

Return true if the current thread has this OpenGL graphics context.

References _threadOfLastMakeCurrent, and OpenThreads::Thread::CurrentThreadId().

## isRealized()

bool osg::GraphicsContext::isRealized | ( |  | ) | const

inline

Return true if the graphics context has been realized and is ready to use.

References isRealizedImplementation().

## isRealizedImplementation()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

Referenced by isRealized().

## isSameKindAs()

virtual bool osg::GraphicsContext::isSameKindAs | ( | const Object * | object | ) | const

inline virtual

Reimplemented from osg::Object.

References GraphicsContext(), and osg::Object::Object().

## libraryName()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## makeContextCurrent()

bool osg::GraphicsContext::makeContextCurrent | ( | GraphicsContext * | readContext | ) |

Make this graphics context current with specified read context. Implemented by calling makeContextCurrentImplementation(). Returns true on success.

References GraphicsContext().

## makeContextCurrentImplementation()

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.

References GraphicsContext().

## makeCurrent()

bool osg::GraphicsContext::makeCurrent | ( |  | ) |

Make this graphics context current. Implemented by calling makeCurrentImplementation(). Returns true on success.

Referenced by osgViewer::ViewerBase::makeCurrent().

## makeCurrentImplementation()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## realize()

bool osg::GraphicsContext::realize | ( |  | ) |

Realize the GraphicsContext.

## realizeImplementation()

virtual bool osg::GraphicsContext::realizeImplementation | ( |  | ) |

pure virtual

Realize the GraphicsContext implementation, Pure virtual - must be implemented by concrete implementations of GraphicsContext.

Implemented in osgViewer::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## registerGraphicsContext()

void osg::GraphicsContext::registerGraphicsContext | ( | GraphicsContext * | gc | ) |

static protected

Register a GraphicsContext.

References GraphicsContext().

## releaseContext()

bool osg::GraphicsContext::releaseContext | ( |  | ) |

Release the graphics context. Returns true on success.

## releaseContextImplementation()

virtual bool osg::GraphicsContext::releaseContextImplementation | ( |  | ) |

pure virtual

Release the graphics context implementation.

Implemented in osgViewer::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

## remove() [1/2]

void osg::GraphicsContext::remove | ( | const std::string & | name | ) |

Remove named operation from OperationQueue.

## remove() [2/2]

void osg::GraphicsContext::remove | ( | Operation * | operation | ) |

Remove operation from OperationQueue.

## removeAllOperations()

void osg::GraphicsContext::removeAllOperations | ( |  | ) |

Remove all operations from OperationQueue.

## removeCamera()

void osg::GraphicsContext::removeCamera | ( | osg::Camera * | camera | ) |

protected

## resized()

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.

References _resizedCallback, and resizedImplementation().

Referenced by osgViewer::GraphicsWindow::setWindowRectangle().

## resizedImplementation()

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.

Referenced by resized().

## runOperations()

virtual void osg::GraphicsContext::runOperations | ( |  | ) |

virtual

Run the operations.

## setClearColor()

void osg::GraphicsContext::setClearColor | ( | const Vec4 & | color | ) |

inline

Sets the clear color.

References _clearColor.

## setClearMask()

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 Cameras attached to the GraphicsContext will do the clear. GraphicsContext::setClearMask() is useful for when the Camera Viewports don't cover the whole context, so the context will fill in the gaps.

References _clearMask.

## setCompileContext()

void osg::GraphicsContext::setCompileContext | ( | unsigned int | contextID,
|  | GraphicsContext * | gc )

static

Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.

References GraphicsContext().

## setDefaultFboId()

void osg::GraphicsContext::setDefaultFboId | ( | GLuint | i | ) |

inline

set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs

References _defaultFboId.

## setGraphicsThread()

void osg::GraphicsContext::setGraphicsThread | ( | GraphicsThread * | gt | ) |

Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

## setResizedCallback()

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.

References _resizedCallback.

## setState()

void osg::GraphicsContext::setState | ( | State * | state | ) |

inline

Set the State object which tracks the current OpenGL state for this graphics context.

References _state.

Referenced by osgViewer::GraphicsWindowX11::GraphicsWindowX11(), and osgViewer::GraphicsWindowEmbedded::init().

## setSwapCallback()

void osg::GraphicsContext::setSwapCallback | ( | SwapCallback * | rc | ) |

inline

Set the swap callback which overrides the GraphicsContext::swapBuffersImplementation(), allowing developers to provide custom behavior for swap. The callback must call GraphicsContext::swapBuffersImplementation()

References _swapCallback.

## swapBuffers()

void osg::GraphicsContext::swapBuffers | ( |  | ) |

swap the front and back buffers.

## swapBuffersCallbackOrImplementation()

void osg::GraphicsContext::swapBuffersCallbackOrImplementation | ( |  | ) |

inline

Convenience method for handling whether to call swapbuffers callback or the standard context swapBuffersImplementation. swapBuffersCallbackOrImplementation() is called by swapBuffers() and osg::SwapBuffersOperation, end users should normally call swapBuffers() rather than swapBuffersCallbackOrImplementation().

References _state, _swapCallback, and swapBuffersImplementation().

## swapBuffersImplementation()

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::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

Referenced by swapBuffersCallbackOrImplementation().

## unregisterGraphicsContext()

void osg::GraphicsContext::unregisterGraphicsContext | ( | GraphicsContext * | gc | ) |

static protected

Unregister a GraphicsContext.

References GraphicsContext().

## valid()

virtual bool osg::GraphicsContext::valid | ( |  | ) | const

pure virtual

Return whether a valid and usable GraphicsContext has been created.

Implemented in osgViewer::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.

Referenced by osgViewer::ViewerBase::makeCurrent().

## Friends And Related Symbol Documentation

## osg::Camera

friend class osg::Camera

friend

## Member Data Documentation

## _cameras

Cameras osg::GraphicsContext::_cameras

protected

Referenced by getCameras(), and getCameras().

## _clearColor

Vec4 osg::GraphicsContext::_clearColor

protected

Referenced by getClearColor(), and setClearColor().

## _clearMask

GLbitfield osg::GraphicsContext::_clearMask

protected

Referenced by getClearMask(), and setClearMask().

## _currentOperation

osg::ref_ptr<Operation> osg::GraphicsContext::_currentOperation

protected

Referenced by getCurrentOperation().

## _defaultFboId

GLuint osg::GraphicsContext::_defaultFboId

protected

Referenced by getDefaultFboId(), and setDefaultFboId().

## _graphicsThread

ref_ptr<GraphicsThread> osg::GraphicsContext::_graphicsThread

protected

Referenced by getGraphicsThread(), and getGraphicsThread().

## _lastClearTick

Timer_t osg::GraphicsContext::_lastClearTick

protected

Referenced by getTimeSinceLastClear().

## _operations

GraphicsOperationQueue osg::GraphicsContext::_operations

protected

Referenced by getOperationsQueue().

## _operationsBlock

osg::ref_ptr<osg::RefBlock> osg::GraphicsContext::_operationsBlock

protected

Referenced by getOperationsBlock().

## _operationsMutex

OpenThreads::Mutex osg::GraphicsContext::_operationsMutex

protected

Referenced by getOperationsMutex().

## _resizedCallback

ref_ptr<ResizedCallback> osg::GraphicsContext::_resizedCallback

protected

Referenced by getResizedCallback(), getResizedCallback(), resized(), and setResizedCallback().

## _state

ref_ptr<State> osg::GraphicsContext::_state

protected

Referenced by getState(), getState(), setState(), and swapBuffersCallbackOrImplementation().

## _swapCallback

ref_ptr<SwapCallback> osg::GraphicsContext::_swapCallback

protected

Referenced by getSwapCallback(), getSwapCallback(), setSwapCallback(), and swapBuffersCallbackOrImplementation().

## _threadOfLastMakeCurrent

size_t osg::GraphicsContext::_threadOfLastMakeCurrent

protected

Referenced by isCurrent().

## _traits

ref_ptr<Traits> osg::GraphicsContext::_traits

protected

Referenced by osgViewer::GraphicsWindow::getSwapGroup(), osgViewer::GraphicsWindow::getSyncToVBlank(), getTraits(), osgViewer::GraphicsWindow::getWindowDecoration(), osgViewer::GraphicsWindow::getWindowName(), osgViewer::GraphicsWindow::getWindowRectangle(), osgViewer::GraphicsWindowEmbedded::GraphicsWindowEmbedded(), osgViewer::GraphicsWindowEmbedded::GraphicsWindowEmbedded(), osgViewer::GraphicsWindowX11::GraphicsWindowX11(), osgViewer::GraphicsWindowEmbedded::init(), osgViewer::GraphicsWindow::setWindowDecoration(), and osgViewer::GraphicsWindow::setWindowRectangle().

The documentation for this class was generated from the following file:

- GraphicsContext