From 2bd868cd1c275b733c081f87d81e8de4537f43f3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 9 Nov 2005 20:26:34 +0000 Subject: [PATCH] Added release and flush of OpenGL objects after build of the terrain database to prevent the build graphics context state leaking into the viewers graphics context set. --- examples/osgsimulation/osgsimulation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/osgsimulation/osgsimulation.cpp b/examples/osgsimulation/osgsimulation.cpp index 9312b3be4..588026bf8 100644 --- a/examples/osgsimulation/osgsimulation.cpp +++ b/examples/osgsimulation/osgsimulation.cpp @@ -96,6 +96,12 @@ osg::Node* createEarth() else dataSet->writeDestination(); scene = dataSet->getDestinationRootNode(); + + // now we must get rid of all the old OpenGL objects before we start using the scene graph again + // otherwise it'll end up in an inconsistent state. + scene->releaseGLObjects(dataSet->getState()); + osg::Texture::flushAllDeletedTextureObjects(0); + osg::Drawable::flushAllDeletedDisplayLists(0); } return scene.release();