diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 1fd48563b..a729743ca 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -221,7 +221,7 @@ class OSG_EXPORT GLBufferObject : public Referenced bool isPBOSupported() const { return _extensions->isPBOSupported; } - static GLBufferObject* createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject); + static osg::ref_ptr createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject); static void deleteAllBufferObjects(unsigned int contextID); static void discardAllBufferObjects(unsigned int contextID); @@ -287,8 +287,8 @@ class OSG_EXPORT GLBufferObjectSet : public Referenced void discardAllDeletedGLBufferObjects(); void flushDeletedGLBufferObjects(double currentTime, double& availableTime); - GLBufferObject* takeFromOrphans(BufferObject* bufferObject); - GLBufferObject* takeOrGenerate(BufferObject* bufferObject); + osg::ref_ptr takeFromOrphans(BufferObject* bufferObject); + osg::ref_ptr takeOrGenerate(BufferObject* bufferObject); void moveToBack(GLBufferObject* to); void addToBack(GLBufferObject* to); @@ -353,7 +353,7 @@ class OSG_EXPORT GLBufferObjectManager : public osg::Referenced bool hasSpace(unsigned int size) const { return (_currGLBufferObjectPoolSize+size)<=_maxGLBufferObjectPoolSize; } bool makeSpace(unsigned int size); - GLBufferObject* generateGLBufferObject(const osg::BufferObject* bufferObject); + osg::ref_ptr generateGLBufferObject(const osg::BufferObject* bufferObject); void handlePendingOrphandedGLBufferObjects(); diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index dd1ccb856..38c473d33 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -583,7 +583,7 @@ bool GLBufferObjectSet::makeSpace(unsigned int& size) return size==0; } -GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject) +osg::ref_ptr GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject) { // take front of orphaned list. ref_ptr glbo = _orphanedGLBufferObjects.front(); @@ -604,11 +604,11 @@ GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject) //OSG_NOTICE<<"Reusing orphaned GLBufferObject, _numOfGLBufferObjects="<<_numOfGLBufferObjects<<" target="< GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject) { // see if we can recyle GLBufferObject from the orphan list { @@ -657,7 +657,7 @@ GLBufferObject* GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject) glbo->setBufferObject(bufferObject); glbo->setProfile(_profile); - return glbo.release(); + return glbo; } // @@ -885,7 +885,7 @@ bool GLBufferObjectManager::makeSpace(unsigned int size) } -GLBufferObject* GLBufferObjectManager::generateGLBufferObject(const BufferObject* bufferObject) +osg::ref_ptr GLBufferObjectManager::generateGLBufferObject(const BufferObject* bufferObject) { ElapsedTime elapsedTime(&(getGenerateTime())); ++getNumberGenerated(); @@ -1051,7 +1051,7 @@ osg::ref_ptr& GLBufferObjectManager::getGLBufferObjectMan return s_GLBufferObjectManager[contextID]; } -GLBufferObject* GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject) +osg::ref_ptr GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject) { return GLBufferObjectManager::getGLBufferObjectManager(contextID)->generateGLBufferObject(bufferObject); }