Skip to content
Permalink
Browse files

Added FrameBufferAttachment::resizeGLObjectBuffers(..) and releaseGLO…

…bjects(..) methods
  • Loading branch information...
robertosfield committed Jul 12, 2019
1 parent f21f269 commit edd0d3e35f07b460585dbf747169519663a1d2d0
Showing with 25 additions and 0 deletions.
  1. +3 −0 include/osg/FrameBufferObject
  2. +22 −0 src/osg/FrameBufferObject.cpp
@@ -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
@@ -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)

0 comments on commit edd0d3e

Please sign in to comment.
You can’t perform that action at this time.