|
openscenegraph
|
#include <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 ©op=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 |
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 |
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::GraphicsOperationQueue |
| typedef std::vector<ScreenSettings> osg::GraphicsContext::ScreenSettingsList |
|
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().
|
protected |
References GraphicsContext().
|
protectedvirtual |
| void osg::GraphicsContext::add | ( | Operation * | operation | ) |
Add operation to end of OperationQueue.
|
protected |
|
inline |
Bind the graphics context to associated texture.
References bindPBufferToTextureImplementation().
|
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().
|
inlinevirtual |
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.
|
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.
References osg::Object::Object().
|
inlineprotectedvirtual |
Clone the type of an object, with Object* return type. Must be defined by derived classes.
Implements osg::Object.
References osg::Object::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.
|
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.
|
static |
Create a graphics context for a specified set of traits.
References GraphicsContext().
| void osg::GraphicsContext::createGraphicsThread | ( | ) |
Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
|
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 |
Decrement the usage count associate with a contextID. Once the contextID goes to 0 the contextID is then free to be reused.
|
static |
Get all the registered graphics contexts.
|
inline |
Get the list of cameras associated with this graphics context.
References _cameras.
|
inline |
Get the const list of cameras associated with this graphics context.
References _cameras.
|
inline |
Returns the clear color.
References _clearColor.
|
inline |
Get the clear mask.
References _clearMask.
|
static |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
References GraphicsContext().
|
inline |
Get the current operations that is being run.
References _currentOperation.
|
inline |
References _defaultFboId.
|
inline |
Get the graphics thread assigned the graphics context.
References _graphicsThread.
|
inline |
Get the const graphics thread assigned the graphics context.
References _graphicsThread.
|
static |
Get the current max ContextID.
|
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.
|
inline |
Get the operations queue mutex.
References _operationsMutex.
|
inline |
Get the operations queue, note you must use the OperationsMutex when accessing the queue.
References _operations.
|
static |
Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID.
References GraphicsContext().
|
static |
Get all the registered graphics contexts associated with a specific contextID.
|
inline |
Get the resized callback which overrides the GraphicsConext::realizedImplementation().
References _resizedCallback.
|
inline |
Get the const resized callback which overrides the GraphicsConext::realizedImplementation().
References _resizedCallback.
|
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().
|
inline |
|
inline |
Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().
References _swapCallback.
|
inline |
Get the const swap callback which overrides the GraphicsContext::swapBuffersImplementation().
References _swapCallback.
|
inline |
References _lastClearTick, osg::Timer::delta_s(), and osg::Timer::instance().
|
inline |
Get the traits of the GraphicsContext.
References _traits.
|
static |
Get the default WindowingSystemInterface for this OS
|
static |
|
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().
|
inline |
Return true if the current thread has this OpenGL graphics context.
References _threadOfLastMakeCurrent, and OpenThreads::Thread::CurrentThreadId().
|
inline |
Return true if the graphics context has been realized and is ready to use.
References isRealizedImplementation().
|
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().
|
inlinevirtual |
Reimplemented from osg::Object.
References GraphicsContext(), and osg::Object::Object().
|
inlinevirtual |
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.
| 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().
|
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().
| bool osg::GraphicsContext::makeCurrent | ( | ) |
Make this graphics context current. Implemented by calling makeCurrentImplementation(). Returns true on success.
Referenced by osgViewer::ViewerBase::makeCurrent().
|
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.
| bool osg::GraphicsContext::realize | ( | ) |
Realize the GraphicsContext.
|
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.
|
staticprotected |
Register a GraphicsContext.
References GraphicsContext().
| bool osg::GraphicsContext::releaseContext | ( | ) |
Release the graphics context. Returns true on success.
|
pure virtual |
Release the graphics context implementation.
Implemented in osgViewer::GraphicsWindow, osgViewer::GraphicsWindowEmbedded, osgViewer::GraphicsWindowWin32, osgViewer::GraphicsWindowX11, osgViewer::PixelBufferWin32, and osgViewer::PixelBufferX11.
| 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.
|
protected |
|
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().
|
virtual |
resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the graphics Window.
Referenced by resized().
|
virtual |
Run the operations.
|
inline |
Sets the clear color.
References _clearColor.
|
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.
|
static |
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.
References GraphicsContext().
|
inline |
set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs
References _defaultFboId.
| void osg::GraphicsContext::setGraphicsThread | ( | GraphicsThread * | gt | ) |
Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
|
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.
|
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().
|
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.
| void osg::GraphicsContext::swapBuffers | ( | ) |
swap the front and back buffers.
|
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().
|
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().
|
staticprotected |
Unregister a GraphicsContext.
References GraphicsContext().
|
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().
|
friend |
|
protected |
Referenced by getCameras(), and getCameras().
|
protected |
Referenced by getClearColor(), and setClearColor().
|
protected |
Referenced by getClearMask(), and setClearMask().
|
protected |
Referenced by getCurrentOperation().
|
protected |
Referenced by getDefaultFboId(), and setDefaultFboId().
|
protected |
Referenced by getGraphicsThread(), and getGraphicsThread().
|
protected |
Referenced by getTimeSinceLastClear().
|
protected |
Referenced by getOperationsQueue().
|
protected |
Referenced by getOperationsBlock().
|
protected |
Referenced by getOperationsMutex().
|
protected |
Referenced by getResizedCallback(), getResizedCallback(), resized(), and setResizedCallback().
Referenced by getState(), getState(), setState(), and swapBuffersCallbackOrImplementation().
|
protected |
Referenced by getSwapCallback(), getSwapCallback(), setSwapCallback(), and swapBuffersCallbackOrImplementation().
|
protected |
Referenced by isCurrent().
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().