Added realize() and isRealized() methods to osg::GraphicsContext.

Added osgcamera example that uses osg::GraphicsContext to create the required
window for rendering too, will eventually use osg::CameraNode to replace usage
of osgUtil::SceneView.
This commit is contained in:
Robert Osfield
2005-08-16 13:29:07 +00:00
parent 75987a045d
commit e8fc5248fa
8 changed files with 182 additions and 10 deletions

View File

@@ -134,19 +134,27 @@ class OSG_EXPORT GraphicsContext : public Referenced
/** Get the const State object which tracks the current OpenGL state for this graphics context.*/
inline const State* getState() const { return _state.get(); }
/** Return true if the current thread has this OpenGL graphics context.*/
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); }
/** Realise the GraphicsContext.*/
virtual bool realize() = 0;
/** Return true if the graphics context has been realised and is ready to use.*/
virtual bool isRealized() const = 0;
/** Release the graphics context.*/
virtual void release() = 0;
/** Make this graphics context current.*/
virtual void makeCurrent() = 0;
/** Make this graphics context current with specified read context.*/
virtual void makeContextCurrent(GraphicsContext* readContext) = 0;
/** Return true if the current thread has this OpenGL graphics context.*/
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); }
/** Bind the graphics context to associated texture.*/
virtual void bindPBufferToTexture(GLenum buffer) = 0;

View File

@@ -36,7 +36,6 @@ class OSGPRODUCER_EXPORT GraphicsContextImplementation : public osg::GraphicsCon
GraphicsContextImplementation(Producer::RenderSurface* rs);
/** Return true of graphics context is realized.*/
bool isRealized() { return _rs.valid() && _rs->isRealized(); }
/** Return the RenderSurface that implements the graphics context.*/
Producer::RenderSurface* getRenderSurface() { return _rs.get(); }
@@ -45,6 +44,12 @@ class OSGPRODUCER_EXPORT GraphicsContextImplementation : public osg::GraphicsCon
const Producer::RenderSurface* getRenderSurface() const { return _rs.get(); }
/** Realise the GraphicsContext.*/
virtual bool realize();
/** Return true if the graphics context has been realised and is ready to use.*/
virtual bool isRealized() const { return _rs.valid() && _rs->isRealized(); }
/** Release the graphics context.*/
virtual void release();