From eb50a15b52d7db4cb7e7955464c307218eaf454d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 18 Apr 2016 20:46:45 +0100 Subject: [PATCH] Fixed ShaderComposer::releaseGLObjects(State*) const method as it's const was missing. Rewrote the ShaderComposer::releaseGLObjects() const method to pass on the releaseGLObjects() calls to any associated Program or Shader objects. --- include/osg/ShaderComposer | 2 +- src/osg/ShaderComposer.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/osg/ShaderComposer b/include/osg/ShaderComposer index a784eaed4..68c6d6c39 100644 --- a/include/osg/ShaderComposer +++ b/include/osg/ShaderComposer @@ -39,7 +39,7 @@ class OSG_EXPORT ShaderComposer : public osg::Object virtual osg::Shader* composeMain(const Shaders& shaders); virtual void addShaderToProgram(Program* program, const Shaders& shaders); - void releaseGLObjects(osg::State* state); + virtual void releaseGLObjects(osg::State* state) const; protected: diff --git a/src/osg/ShaderComposer.cpp b/src/osg/ShaderComposer.cpp index 09057b5a3..f2e167c12 100644 --- a/src/osg/ShaderComposer.cpp +++ b/src/osg/ShaderComposer.cpp @@ -37,10 +37,21 @@ ShaderComposer::~ShaderComposer() OSG_INFO<<"ShaderComposer::~ShaderComposer() "<second->releaseGLObjects(state); + } + + for(ShaderMainMap::const_iterator itr = _shaderMainMap.begin(); + itr != _shaderMainMap.end(); + ++itr) + { + itr->second->releaseGLObjects(state); + } } osg::Program* ShaderComposer::getOrCreateProgram(const ShaderComponents& shaderComponents)