Added Object::resizeGLObjectBuffers(uint) method to help improve the ability
to change the number of active graphics contexts on the fly during an applications life.
This commit is contained in:
@@ -241,6 +241,13 @@ void Camera::detach(BufferComponent buffer)
|
||||
_bufferAttachmentMap.erase(buffer);
|
||||
}
|
||||
|
||||
void Camera::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_renderingCache.resize(maxSize);
|
||||
|
||||
Transform::resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void Camera::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (state) const_cast<Camera*>(this)->_renderingCache[state->getContextID()] = 0;
|
||||
|
||||
@@ -479,6 +479,14 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
|
||||
|
||||
}
|
||||
|
||||
void Drawable::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_stateset.valid()) _stateset->resizeGLObjectBuffers(maxSize);
|
||||
if (_drawCallback.valid()) _drawCallback->resizeGLObjectBuffers(maxSize);
|
||||
|
||||
_globjList.resize(maxSize);
|
||||
}
|
||||
|
||||
void Drawable::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (_stateset.valid()) _stateset->releaseGLObjects(state);
|
||||
|
||||
@@ -183,6 +183,11 @@ void FragmentProgram::apply(State& state) const
|
||||
}
|
||||
}
|
||||
|
||||
void FragmentProgram::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_fragmentProgramIDList.resize(maxSize);
|
||||
}
|
||||
|
||||
void FragmentProgram::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (!state) const_cast<FragmentProgram*>(this)->dirtyFragmentProgramObject();
|
||||
|
||||
@@ -209,6 +209,18 @@ void Geode::compileDrawables(RenderInfo& renderInfo)
|
||||
}
|
||||
}
|
||||
|
||||
void Geode::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
Node::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
for(DrawableList::const_iterator itr=_drawables.begin();
|
||||
itr!=_drawables.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void Geode::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
Node::releaseGLObjects(state);
|
||||
|
||||
@@ -379,6 +379,18 @@ BoundingSphere Group::computeBound() const
|
||||
return bsphere;
|
||||
}
|
||||
|
||||
void Group::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
Node::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
for(NodeList::const_iterator itr=_children.begin();
|
||||
itr!=_children.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
Node::releaseGLObjects(state);
|
||||
|
||||
@@ -491,6 +491,14 @@ void Node::dirtyBound()
|
||||
}
|
||||
}
|
||||
|
||||
void Node::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_stateset.valid()) _stateset->resizeGLObjectBuffers(maxSize);
|
||||
if (_updateCallback.valid()) _updateCallback->resizeGLObjectBuffers(maxSize);
|
||||
if (_eventCallback.valid()) _eventCallback->resizeGLObjectBuffers(maxSize);
|
||||
if (_cullCallback.valid()) _cullCallback->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void Node::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_stateset.valid()) _stateset->releaseGLObjects(state);
|
||||
|
||||
@@ -121,6 +121,11 @@ DrawElementsUByte::~DrawElementsUByte()
|
||||
releaseGLObjects();
|
||||
}
|
||||
|
||||
void DrawElementsUByte::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_vboList.resize(maxSize);
|
||||
}
|
||||
|
||||
void DrawElementsUByte::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (state)
|
||||
@@ -209,6 +214,11 @@ DrawElementsUShort::~DrawElementsUShort()
|
||||
releaseGLObjects();
|
||||
}
|
||||
|
||||
void DrawElementsUShort::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_vboList.resize(maxSize);
|
||||
}
|
||||
|
||||
void DrawElementsUShort::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (state)
|
||||
@@ -298,6 +308,11 @@ DrawElementsUInt::~DrawElementsUInt()
|
||||
releaseGLObjects();
|
||||
}
|
||||
|
||||
void DrawElementsUInt::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_vboList.resize(maxSize);
|
||||
}
|
||||
|
||||
void DrawElementsUInt::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (state)
|
||||
|
||||
@@ -1994,6 +1994,16 @@ void Program::dirtyProgram()
|
||||
}
|
||||
|
||||
|
||||
void Program::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
for( unsigned int i=0; i < _shaderList.size(); ++i )
|
||||
{
|
||||
if (_shaderList[i].valid()) _shaderList[i]->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
_pcpList.resize(maxSize);
|
||||
}
|
||||
|
||||
void Program::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
for( unsigned int i=0; i < _shaderList.size(); ++i )
|
||||
|
||||
@@ -196,6 +196,10 @@ Shader::Type Shader::getTypeId( const std::string& tname )
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
void Shader::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_pcsList.resize(maxSize);
|
||||
}
|
||||
|
||||
void Shader::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
|
||||
@@ -1202,6 +1202,28 @@ void StateSet::compileGLObjects(State& state) const
|
||||
}
|
||||
}
|
||||
|
||||
void StateSet::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
for(AttributeList::const_iterator itr = _attributeList.begin();
|
||||
itr!=_attributeList.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
for(TextureAttributeList::const_iterator taitr=_textureAttributeList.begin();
|
||||
taitr!=_textureAttributeList.end();
|
||||
++taitr)
|
||||
{
|
||||
for(AttributeList::const_iterator itr = taitr->begin();
|
||||
itr!=taitr->end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StateSet::releaseGLObjects(State* state) const
|
||||
{
|
||||
for(AttributeList::const_iterator itr = _attributeList.begin();
|
||||
|
||||
@@ -1295,6 +1295,11 @@ void Texture::compileGLObjects(State& state) const
|
||||
apply(state);
|
||||
}
|
||||
|
||||
void Texture::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_textureObjectBuffer.resize(maxSize);
|
||||
}
|
||||
|
||||
void Texture::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (!state) const_cast<Texture*>(this)->dirtyTextureObject();
|
||||
|
||||
@@ -183,6 +183,11 @@ void VertexProgram::apply(State& state) const
|
||||
}
|
||||
}
|
||||
|
||||
void VertexProgram::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_vertexProgramIDList.resize(maxSize);
|
||||
}
|
||||
|
||||
void VertexProgram::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (!state) const_cast<VertexProgram*>(this)->dirtyVertexProgramObject();
|
||||
|
||||
Reference in New Issue
Block a user