From 5ad297e6ff6f9fae76b3ae2c00d4bc312ed0a0e6 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 3 Dec 2020 18:41:32 +0000 Subject: [PATCH] Guarantee glow updater regenerates shaders on completion Previously, it would edit the odd numbered stateset, then regenerate shaders for the even-numbered one, then edit the even numbered one, and regenerate shaders for the odd numbered one (or vice versa if it finished during an even numbered frame). This would leave one of the shader programs still trying to use the state that had been removed. --- components/sceneutil/util.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/sceneutil/util.cpp b/components/sceneutil/util.cpp index a23f3f1090..2c0d8efa0c 100644 --- a/components/sceneutil/util.cpp +++ b/components/sceneutil/util.cpp @@ -112,6 +112,8 @@ void GlowUpdater::apply(osg::StateSet *stateset, osg::NodeVisitor *nv) removeTexture(stateset); this->reset(); mDone = true; + // normally done in StateSetUpdater::operator(), but needs doing here so the shader visitor sees the right StateSet + mNode->setStateSet(stateset); mResourceSystem->getSceneManager()->recreateShaders(mNode); } if (mOriginalDuration < 0) // if this glowupdater was originally a permanent glow