diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index daf82b9dac..9251e5683e 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -44,8 +44,10 @@ void OgreRenderer::cleanup() delete mFader; mFader = NULL; - OGRE_DELETE mRoot; + delete mRoot; mRoot = NULL; + + unloadPlugins(); } void OgreRenderer::start() @@ -103,6 +105,31 @@ bool OgreRenderer::loadPlugins() return true; } +bool OgreRenderer::unloadPlugins() +{ + #ifdef ENABLE_PLUGIN_GL + delete mGLPlugin; + mGLPlugin = NULL; + #endif + #ifdef ENABLE_PLUGIN_Direct3D9 + delete mD3D9Plugin; + mD3D9Plugin = NULL; + #endif + #ifdef ENABLE_PLUGIN_CgProgramManager + delete mCgPlugin; + mCgPlugin = NULL; + #endif + #ifdef ENABLE_PLUGIN_OctreeSceneManager + delete mOctreePlugin; + mOctreePlugin = NULL; + #endif + #ifdef ENABLE_PLUGIN_ParticleFX + delete mParticleFXPlugin; + mParticleFXPlugin = NULL; + #endif + return true; +} + void OgreRenderer::update(float dt) { mFader->update(dt); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index 00e094b4dc..b71da90202 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -151,7 +151,9 @@ namespace OEngine /// Start the main rendering loop void start(); - bool loadPlugins() ; + bool loadPlugins(); + + bool unloadPlugins(); void update(float dt);