From 543b2ee56e516abdceb338e7d8a00380525bc015 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 13 Dec 2010 17:09:31 +0000 Subject: [PATCH] Added resizeGLObjectBuffers(uint) and relaseGLObjects(State*) to BufferData. --- include/osg/BufferObject | 10 +++++++++- src/osg/BufferObject.cpp | 20 +++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 2632e3cbf..9b9205cb8 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -631,7 +631,15 @@ class OSG_EXPORT BufferData : public Object /** Get modified count value.*/ inline unsigned int getModifiedCount() const { return _modifiedCount; } - protected: + /** Resize any per context GLObject buffers to specified size. */ + virtual void resizeGLObjectBuffers(unsigned int maxSize); + + /** If State is non-zero, this function releases OpenGL objects for + * the specified graphics context. Otherwise, releases OpenGL objects + * for all graphics contexts. */ + void releaseGLObjects(State* state=0) const; + +protected: virtual ~BufferData(); diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index bba71b187..f67e1d84a 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -1195,7 +1195,7 @@ void BufferObject::resizeGLObjectBuffers(unsigned int maxSize) void BufferObject::releaseGLObjects(State* state) const { - // OSG_NOTICE<<"BufferObject::releaseGLObjects("<getContextID(); @@ -1334,6 +1334,24 @@ void BufferData::setBufferObject(BufferObject* bufferObject) _bufferIndex = _bufferObject.valid() ? _bufferObject->addBufferData(this) : 0; } +void BufferData::resizeGLObjectBuffers(unsigned int maxSize) +{ + if (_bufferObject.valid()) + { + _bufferObject->resizeGLObjectBuffers(maxSize); + } +} + +void BufferData::releaseGLObjects(State* state) const +{ + OSG_INFO<<"BufferData::releaseGLObjects("<releaseGLObjects(state); + } +} + + ////////////////////////////////////////////////////////////////////////////////// // // VertexBufferObject