OGRE插件设计-Texture与GLTexture

背景:

学习OGRE,在OGRE中 Core是最小的精简逻辑集合,而真正的功能则需要插件来实现,但是作为插件应该与Core保持最小的连接,同时Core不会调用插件的接口,而动态链接库又不能直接把类连接进入,那么如何能实现利用Core来调用插件的内容呢?

首先GLTexture的生成由GLTextureManager生成和管理,而Manager由GLRenderSystem的_initialise()函数初始化,而GLRenderSystem是如何在Root中被调用的呢?

    Root中拥有setRenderSystem(RenderSystem* system)函数,利用此函数设定Root中的mActiveRenderer成员变量,首先在SampleContext::go()->的SampleContext::InitApp函数中->SampleBrowser::oneTimeconfig()->Root::restoreConfig()->Root::getRenderSystemByName(..)。在这里找到了Root::mRenderers成员变量,那么mRenderers是在哪里被激活和初始化的呢?

 Root在它的构造函数中使用loadPlugins()函数->Root::loadPlugin(const String& pluginName)->_OgreGLExport dllStartPlugin->Root::installPlugin(Plugin* plugin)->GLPlugin::install()-> Root::addRenderSystem()

 

而我们的系统中:

CNewViWoUIApp::InitInstance()->VPE::CModuleManager::AutoloadPlugins()->VPE::CmoduleManager::LoadPlugin(...)->VPE::CmoduleManager::InvokePluginInit(..)->VisPlugin.dll!Init();

posted @ 2014-03-13 15:56  恋云de游鱼  阅读(320)  评论(0编辑  收藏  举报