C++ (Qt) // create the main ogre object mOgreRoot = new Ogre::Root( plugins_file, ogre_cfg_file, ogre_log ); // setup a renderer Ogre::RenderSystemList::const_iterator renderers = mOgreRoot->getAvailableRenderers().begin(); Ogre::LogManager::getSingleton().logMessage("!!Get Renders"); while(renderers != mOgreRoot->getAvailableRenderers().end()) { Ogre::LogManager::getSingleton().logMessage("ku"); Ogre::String rName = (*renderers)->getName(); Ogre::LogManager::getSingleton().logMessage(rName); if (rName == "OpenGL Rendering Subsystem") break; renderers++; } Ogre::LogManager::getSingleton().logMessage("Render ok!"); Ogre::RenderSystem *renderSystem = *renderers;
Запускается C:\Qt\OgreSDK\bin\Release\OgreTest.exe...Creating resource group GeneralCreating resource group InternalCreating resource group AutodetectSceneManagerFactory for type 'DefaultSceneManager' registered.Registering ResourceManager for type MaterialRegistering ResourceManager for type MeshRegistering ResourceManager for type SkeletonMovableObjectFactory for type 'ParticleSystem' registered.OverlayElementFactory for type Panel registered.OverlayElementFactory for type BorderPanel registered.OverlayElementFactory for type TextArea registered.Registering ResourceManager for type FontArchiveFactory for archive type FileSystem registered.ArchiveFactory for archive type Zip registered.DDS codec registeringFreeImage version: 3.13.1This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for detailsSupported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwzRegistering ResourceManager for type HighLevelGpuProgramRegistering ResourceManager for type CompositorMovableObjectFactory for type 'Entity' registered.MovableObjectFactory for type 'Light' registered.MovableObjectFactory for type 'BillboardSet' registered.MovableObjectFactory for type 'ManualObject' registered.MovableObjectFactory for type 'BillboardChain' registered.MovableObjectFactory for type 'RibbonTrail' registered.../plugins.cfg not found, automatic plugin loading disabled.*-*-* OGRE Initialising*-*-* Version 1.7.2 (Cthugha)!!Get RendersПрограмма неожиданно завершилась.C:\Qt\OgreSDK\bin\Release\OgreTest.exe завершился с кодом -1073741819
bool GraphicSystem::init() { //----------------------------------------------------- // 1 Создание рута //----------------------------------------------------- mRoot = new Ogre::Root(mPluginsCfg, mOgreCfg, mOgreLogFile); //----------------------------------------------------- // 2 Настройка приложение и создание окна //----------------------------------------------------- if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())) { delete mRoot; return false; } mRenderWindow = mRoot->initialise(true, "JustGame"); // Set default mipmap level (note: some APIs ignore this) Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); //----------------------------------------------------- // 3 Загрузка ресурсов из конфига //----------------------------------------------------- Ogre::ConfigFile xConfigFile; xConfigFile.load(mResourcesCfg); // Проходим по всем секция в файле Ogre::ConfigFile::SectionIterator xSection = xConfigFile.getSectionIterator(); Ogre::String xSecName, xTypeName, xArchName; while (xSection.hasMoreElements()) { xSecName = xSection.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = xSection.getNext(); Ogre::ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); i++) { xTypeName = i->first; xArchName = i->second; Ogre::ResourceGroupManager::getSingleton().addResourceLocation( xArchName, xTypeName, xSecName); } } // Грузим все ресурсы Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); //----------------------------------------------------- // 4 Создание менеджера сцен // // ST_GENERIC = octree // ST_EXTERIOR_CLOSE = simple terrain // ST_EXTERIOR_FAR = nature terrain (depreciated) // ST_EXTERIOR_REAL_FAR = paging landscape // ST_INTERIOR = Quake3 BSP //----------------------------------------------------- mSceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC); //----------------------------------------------------- // 5 Создание камеры //----------------------------------------------------- mCamera = mSceneManager->createCamera("MainCamera"); mCamera->setPosition(Ogre::Vector3(0,0,100)); mCamera->lookAt(Ogre::Vector3(0,0,0)); mCamera->setNearClipDistance(5); //----------------------------------------------------- // 6 Создание вьюпорта //----------------------------------------------------- Ogre::Viewport* xViewport = mRenderWindow->addViewport(mCamera); xViewport->setBackgroundColour(Ogre::ColourValue(0,0,0)); mCamera->setAspectRatio(Ogre::Real(xViewport->getActualWidth()) / Ogre::Real(xViewport->getActualHeight())); // Set ambient light mSceneManager->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5)); //----------------------------------------------------- // 7 Инициализация MyGUI //----------------------------------------------------- mOgrePlatform = new MyGUI::OgrePlatform(); mOgrePlatform->initialise(mRenderWindow, mSceneManager, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mMyGUILogFile); // mWindow is Ogre::RenderWindow*, mSceneManager is Ogre::SceneManager* mMyGUI = new MyGUI::Gui(); mMyGUI->initialise(); //----------------------------------------------------- // 8 Добавление слушателя событий //----------------------------------------------------- Ogre::WindowEventUtilities::addWindowEventListener(mRenderWindow, this); mRoot->addFrameListener(this); return true; }