Added releaseGLObjects(State*) support into osg::FrameBufferObject, osg::RenderBin and osg::RenderStage

to ensure proper clean up of FBO's on closing a graphics context.
This commit is contained in:
Robert Osfield
2011-04-20 11:45:01 +00:00
parent f564926570
commit 70aa087f6e
8 changed files with 158 additions and 2 deletions

View File

@@ -242,6 +242,14 @@ namespace osg
static int getMaxSamples(unsigned int contextID, const FBOExtensions *ext);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);
/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const;
protected:
virtual ~RenderBuffer();
RenderBuffer &operator=(const RenderBuffer &) { return *this; }
@@ -451,6 +459,14 @@ namespace osg
* in the OpenGL context related to contextID.*/
static void discardDeletedFrameBufferObjects(unsigned int contextID);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);
/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const;
protected:
virtual ~FrameBufferObject();
FrameBufferObject& operator = (const FrameBufferObject&) { return *this; }

View File

@@ -148,6 +148,11 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
void copyLeavesFromStateGraphListToRenderLeafList();
/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* state= 0) const;
protected:
virtual ~RenderBin();

View File

@@ -253,7 +253,12 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
/** clear the references to any dependent cameras.*/
void clearReferencesToDependentCameras();
protected:
/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* state= 0) const;
protected:
virtual ~RenderStage();