Changed the return types of makeCurrent to bool, and added a bool GraphicsContext::releaseContext method
along with implementations in osgViewer.
This commit is contained in:
@@ -219,15 +219,18 @@ class OSG_EXPORT GraphicsContext : public Referenced
|
||||
|
||||
|
||||
/** Make this graphics context current.
|
||||
* Implementated by first aquiring a lock of the GraphicsContext mutex, and then doing a call to makeCurrentImplementation(). */
|
||||
void makeCurrent();
|
||||
* Implementated by calling makeCurrentImplementation().
|
||||
* Returns true on success. */
|
||||
bool makeCurrent();
|
||||
|
||||
/** Make this graphics context current with specified read context.
|
||||
* Implementated by first aquiring a lock of the GraphicsContext mutex, and then doing a call to makeContextCurrentImplementation(). */
|
||||
void makeContextCurrent(GraphicsContext* readContext);
|
||||
* Implementated by calling makeContextCurrentImplementation().
|
||||
* Returns true on success. */
|
||||
bool makeContextCurrent(GraphicsContext* readContext);
|
||||
|
||||
/** Release the graphics context by unlocking the GraphicsContext mutex.*/
|
||||
void releaseContext();
|
||||
/** Release the graphics context.
|
||||
* Returns true on success. */
|
||||
bool releaseContext();
|
||||
|
||||
/** Return true if the current thread has this OpenGL graphics context.*/
|
||||
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); }
|
||||
@@ -264,11 +267,14 @@ class OSG_EXPORT GraphicsContext : public Referenced
|
||||
|
||||
/** Make this graphics context current implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
virtual void makeCurrentImplementation() = 0;
|
||||
virtual bool makeCurrentImplementation() = 0;
|
||||
|
||||
/** Make this graphics context current with specified read context implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
virtual void makeContextCurrentImplementation(GraphicsContext* readContext) = 0;
|
||||
virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0;
|
||||
|
||||
/** Release the graphics context implementation.*/
|
||||
virtual bool releaseContextImplementation() = 0;
|
||||
|
||||
/** Pure virtual, Bind the graphics context to associated texture implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
@@ -278,6 +284,8 @@ class OSG_EXPORT GraphicsContext : public Referenced
|
||||
* Pure virtual - must be implemented by Concrate implementations of GraphicsContext. */
|
||||
virtual void swapBuffersImplementation() = 0;
|
||||
|
||||
|
||||
|
||||
/** 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 resized(int x, int y, int width, int height)
|
||||
@@ -332,7 +340,6 @@ class OSG_EXPORT GraphicsContext : public Referenced
|
||||
Vec4 _clearColor;
|
||||
GLbitfield _clearMask;
|
||||
|
||||
OpenThreads::Mutex _mutex;
|
||||
OpenThreads::Thread* _threadOfLastMakeCurrent;
|
||||
|
||||
typedef std::list< ref_ptr<GraphicsOperation> > OperationQueue;
|
||||
|
||||
@@ -150,6 +150,20 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
|
||||
void keyRelease(int key, double time);
|
||||
|
||||
|
||||
/** Method for adapting close window events.*/
|
||||
void closeWindow() { closeWindow(getTime()); }
|
||||
|
||||
/** Method for adapting close window event with specified event time.*/
|
||||
void closeWindow(double time);
|
||||
|
||||
|
||||
/** Method for adapting application quit events.*/
|
||||
void quitApplication() { quitApplication(getTime()); }
|
||||
|
||||
/** Method for adapting application quit events with specified event time.*/
|
||||
void quitApplication(double time);
|
||||
|
||||
|
||||
/** Method for adapting frame events.*/
|
||||
void frame(double time);
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ public:
|
||||
SCROLL,
|
||||
PEN_PRESSURE,
|
||||
PEN_PROXIMITY_ENTER,
|
||||
PEN_PROXIMITY_LEAVE
|
||||
PEN_PROXIMITY_LEAVE,
|
||||
CLOSE_WINDOW,
|
||||
QUIT_APPLICATION
|
||||
};
|
||||
|
||||
enum KeySymbol
|
||||
|
||||
@@ -56,10 +56,13 @@ class OSGPRODUCER_EXPORT GraphicsContextImplementation : public osg::GraphicsCon
|
||||
virtual void closeImplementation();
|
||||
|
||||
/** Make this graphics context current.*/
|
||||
virtual void makeCurrentImplementation();
|
||||
virtual bool makeCurrentImplementation();
|
||||
|
||||
/** Make this graphics context current with specified read context.*/
|
||||
virtual void makeContextCurrentImplementation(osg::GraphicsContext* readContext);
|
||||
virtual bool makeContextCurrentImplementation(osg::GraphicsContext* readContext);
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation();
|
||||
|
||||
/** Bind the graphics context to associated texture.*/
|
||||
virtual void bindPBufferToTextureImplementation(GLenum buffer);
|
||||
|
||||
@@ -74,15 +74,18 @@ class OSGVIEWER_EXPORT GraphicsWindow : public osg::GraphicsContext, public osgG
|
||||
|
||||
/** Make this graphics context current implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
virtual void makeCurrentImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeCurrentImplementation() not implemented."<<std::endl; }
|
||||
virtual bool makeCurrentImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeCurrentImplementation() not implemented."<<std::endl; return false;}
|
||||
|
||||
/** Make this graphics context current with specified read context implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
virtual void makeContextCurrentImplementation(GraphicsContext* /*readContext*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeContextCurrentImplementation(..) not implemented."<<std::endl; }
|
||||
virtual bool makeContextCurrentImplementation(GraphicsContext* /*readContext*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeContextCurrentImplementation(..) not implemented."<<std::endl; return false;}
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::releaseContextImplementation(..) not implemented."<<std::endl; return false; }
|
||||
|
||||
/** Pure virtual, Bind the graphics context to associated texture implementation.
|
||||
* Pure virtual - must be implemented by concrate implementations of GraphicsContext. */
|
||||
virtual void bindPBufferToTextureImplementation(GLenum /*buffer*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::void bindPBufferToTextureImplementation(..) not implemented."<<std::endl; }
|
||||
virtual void bindPBufferToTextureImplementation(GLenum /*buffer*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::bindPBufferToTextureImplementation(..) not implemented."<<std::endl; }
|
||||
|
||||
/** Swap the front and back buffers implementation.
|
||||
* Pure virtual - must be implemented by Concrate implementations of GraphicsContext. */
|
||||
|
||||
@@ -56,7 +56,10 @@ class GraphicsWindowCocoa : public osgViewer::GraphicsWindow
|
||||
virtual void closeImplementation();
|
||||
|
||||
/** Make this graphics context current.*/
|
||||
virtual void makeCurrentImplementation();
|
||||
virtual bool makeCurrentImplementation();
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation();
|
||||
|
||||
/** Swap the front and back buffers.*/
|
||||
virtual void swapBuffersImplementation();
|
||||
|
||||
@@ -56,7 +56,10 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow
|
||||
virtual void closeImplementation();
|
||||
|
||||
/** Make this graphics context current.*/
|
||||
virtual void makeCurrentImplementation();
|
||||
virtual bool makeCurrentImplementation();
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation();
|
||||
|
||||
/** Swap the front and back buffers.*/
|
||||
virtual void swapBuffersImplementation();
|
||||
|
||||
@@ -70,7 +70,10 @@ class GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
virtual void closeImplementation();
|
||||
|
||||
/** Make this graphics context current.*/
|
||||
virtual void makeCurrentImplementation();
|
||||
virtual bool makeCurrentImplementation();
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation();
|
||||
|
||||
/** Swap the front and back buffers.*/
|
||||
virtual void swapBuffersImplementation();
|
||||
|
||||
Reference in New Issue
Block a user