Added resizeGLObjectBuffers(uint) and relaseGLObjects(State*) to BufferData.

This commit is contained in:
Robert Osfield
2010-12-13 17:09:31 +00:00
parent eb9510eb72
commit 543b2ee56e
2 changed files with 28 additions and 2 deletions

View File

@@ -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();

View File

@@ -1195,7 +1195,7 @@ void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
void BufferObject::releaseGLObjects(State* state) const
{
// OSG_NOTICE<<"BufferObject::releaseGLObjects("<<state<<")"<<std::endl;
OSG_INFO<<"BufferObject::releaseGLObjects("<<state<<")"<<std::endl;
if (state)
{
unsigned int contextID = state->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("<<state<<")"<<std::endl;
if (_bufferObject.valid())
{
_bufferObject->releaseGLObjects(state);
}
}
//////////////////////////////////////////////////////////////////////////////////
//
// VertexBufferObject