无需安装程序对话框即可启动Ogre BaseApplication

时间:2012-05-06 17:22:15

标签: c++ installation render ogre

我正在编写自己的Ogre应用程序,基于基本的食人魔教程。

有没有人知道在没有首次设置对话框的情况下启动OgreRenderWindow的方法?

我知道Ogre Basic tutorial 6,但它不起作用。

感谢4位帮助

2 个答案:

答案 0 :(得分:3)

对于较新版本的Ogre,上述解决方案无效。

您可以执行以下操作....

  #if defined OIS_LINUX_PLATFORM
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_ParticleFX");
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_CgProgramManager");
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_OctreeSceneManager");
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_PCZSceneManager");
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_OctreeZone");
  mRoot->loadPlugin("/usr/lib/OGRE/Plugin_BSPSceneManager");
  mRoot->loadPlugin("/usr/lib/OGRE/RenderSystem_GL");
  #endif

  Ogre::RenderSystemList::const_iterator renderers = mRoot->getAvailableRenderers().begin();

  while(renderers != mRoot->getAvailableRenderers().end())
  {
    Ogre::String rName = (*renderers)->getName();

    if (rName == "OpenGL Rendering Subsystem")
      break;

    renderers++;
  }

  Ogre::RenderSystem *renderSystem = *renderers;
  renderSystem->setConfigOption("Full Screen","No");
  renderSystem->setConfigOption("Video Mode","1024 x 768 @ 32-bit colour");
  renderSystem->setConfigOption("Display Frequency","50 Hz");
  renderSystem->setConfigOption("FSAA","16");
  renderSystem->setConfigOption("Fixed Pipeline Enabled","Yes");
  renderSystem->setConfigOption("RTT Preferred Mode","FBO");
  renderSystem->setConfigOption("VSync","No");
  renderSystem->setConfigOption("sRGB Gamma Conversion","No");

  mRoot->setRenderSystem(renderSystem); 

  // Create a render window
  mWindow =  mRoot->initialise(true, "MyGame v0.0.1");

答案 1 :(得分:2)

您可以在没有设置对话框here的情况下找到Ogre init的示例。

对于Ogre :: Root实例,您只需使用setRenderSystem设置渲染系统,然后可以使用setConfigOption()

    Root* root = new Root; 
    root->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL");      
    RenderSystemList *rs = root->getAvailableRenderers(); 
    if(rs&&rs->size()&&rs->at(0)->getName().compare("RenderSystem_GL"))
    { 
             RenderSystem * r=rs->at(0); 
             root->setRenderSystem(r); 

             r->setConfigOption("Full Screen","No");  
             r->setConfigOption("Video Mode","800 x 600 @ 16-bit colour"); 
     }
     else
     { 
             // report error
     }