Added FrameBufferAttachment::resizeGLObjectBuffers(..) and releaseGLObjects(..) methods

This commit is contained in:
Robert Osfield 2019-07-12 16:09:12 +01:00
parent 7dbcb4b7d3
commit 079cf6c090
2 changed files with 25 additions and 0 deletions

View File

@ -304,6 +304,9 @@ class OSG_EXPORT FrameBufferAttachment
unsigned int getTexture3DZOffset() const;
unsigned int getTextureArrayLayer() const;
void resizeGLObjectBuffers(unsigned int maxSize);
void releaseGLObjects(osg::State* = 0) const;
private:
// use the Pimpl idiom to avoid dependency from
// all Texture* headers

View File

@ -565,6 +565,18 @@ unsigned int FrameBufferAttachment::getTextureArrayLayer() const
return _ximpl->zoffset;
}
void FrameBufferAttachment::resizeGLObjectBuffers(unsigned int maxSize)
{
if (_ximpl->renderbufferTarget.valid()) _ximpl->renderbufferTarget->resizeGLObjectBuffers(maxSize);
if (_ximpl->textureTarget.valid()) _ximpl->textureTarget->resizeGLObjectBuffers(maxSize);
}
void FrameBufferAttachment::releaseGLObjects(osg::State* state) const
{
if (_ximpl->renderbufferTarget.valid()) _ximpl->renderbufferTarget->releaseGLObjects(state);
if (_ximpl->textureTarget.valid()) _ximpl->textureTarget->releaseGLObjects(state);
}
/**************************************************************************
* FrameBufferObject
**************************************************************************/
@ -594,6 +606,11 @@ void FrameBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
_fboID.resize(maxSize);
_unsupported.resize(maxSize);
_fboID.resize(maxSize);
for(AttachmentMap::iterator itr = _attachments.begin(); itr != _attachments.end(); ++itr)
{
itr->second.resizeGLObjectBuffers(maxSize);
}
}
void FrameBufferObject::releaseGLObjects(osg::State* state) const
@ -618,6 +635,11 @@ void FrameBufferObject::releaseGLObjects(osg::State* state) const
}
}
}
for(AttachmentMap::const_iterator itr = _attachments.begin(); itr != _attachments.end(); ++itr)
{
itr->second.releaseGLObjects(state);
}
}
void FrameBufferObject::setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment)