Added setThreadSafeRefUnref, resizeGLObjectBuffers and releaseGLObjects to OverlayNode

This commit is contained in:
Robert Osfield 2007-01-11 10:21:11 +00:00
parent 877a32c3eb
commit dd958be8a4
2 changed files with 44 additions and 0 deletions

View File

@ -87,6 +87,17 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group
/** Get the const camera used to implement the render to texture of the overlay subgraph.*/
const osg::Camera* getCamera() const { return _camera.get(); }
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/);
/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const;
protected :
virtual ~OverlayNode() {}

View File

@ -45,6 +45,39 @@ OverlayNode::OverlayNode(const OverlayNode& copy, const osg::CopyOp& copyop):
init();
}
void OverlayNode::setThreadSafeRefUnref(bool threadSafe)
{
osg::Group::setThreadSafeRefUnref(threadSafe);
if (_camera.valid()) _camera->setThreadSafeRefUnref(threadSafe);
if (_overlaySubgraph.valid()) _overlaySubgraph->setThreadSafeRefUnref(threadSafe);
if (_texgenNode.valid()) _texgenNode->setThreadSafeRefUnref(threadSafe);
if (_mainSubgraphStateSet.valid()) _mainSubgraphStateSet->setThreadSafeRefUnref(threadSafe);
if (_texture.valid()) _texture->setThreadSafeRefUnref(threadSafe);
}
void OverlayNode::resizeGLObjectBuffers(unsigned int maxSize)
{
osg::Group::resizeGLObjectBuffers(maxSize);
if (_camera.valid()) _camera->resizeGLObjectBuffers(maxSize);
if (_overlaySubgraph.valid()) _overlaySubgraph->resizeGLObjectBuffers(maxSize);
if (_texgenNode.valid()) _texgenNode->resizeGLObjectBuffers(maxSize);
if (_mainSubgraphStateSet.valid()) _mainSubgraphStateSet->resizeGLObjectBuffers(maxSize);
if (_texture.valid()) _texture->resizeGLObjectBuffers(maxSize);
}
void OverlayNode::releaseGLObjects(osg::State* state) const
{
osg::Group::releaseGLObjects(state);
if (_camera.valid()) _camera->releaseGLObjects(state);
if (_overlaySubgraph.valid()) _overlaySubgraph->releaseGLObjects(state);
if (_texgenNode.valid()) _texgenNode->releaseGLObjects(state);
if (_mainSubgraphStateSet.valid()) _mainSubgraphStateSet->releaseGLObjects(state);
if (_texture.valid()) _texture->releaseGLObjects(state);
}
void OverlayNode::init()
{