This is the solution I use in ShortHike. I have disable the plugins.cfg file and load the plugins manually instead. I use this snippet of code to check for the DirectX version and to load the rendersystem. The GetDXVersion is included with the DirectX SDK.
This snipped guards against two common situations:
- The computer is running an older version of DirectX (5, 6, 7 etc). Loading the DX9 plugin would crash your application with a missing DLL call
- You have compiled OGRE on 9.0c and the user has 9.0b. The versions aren't compatible so the we need an inner try/catch
Enjoy!

Code: Select all
void
Main::loadRenderSystems()
{
Root* ogreRoot = Root::getSingletonPtr();
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
HRESULT hr;
DWORD dwDirectXVersion = 0;
TCHAR strDirectXVersion[10];
hr = GetDXVersion( &dwDirectXVersion, strDirectXVersion, 10 );
if( SUCCEEDED(hr) ) {
ostringstream dxinfoStream;
dxinfoStream << "DirectX version: " << strDirectXVersion;
LogManager::getSingleton().logMessage(dxinfoStream.str());
if(dwDirectXVersion >= 0x00090000) {
try {
ogreRoot->loadPlugin("RenderSystem_Direct3D9");
}
catch(Exception& e) {
LogManager::getSingleton().logMessage(String("Unable to create D3D9 RenderSystem: ") + e.getFullDescription());
}
}
}
#endif
try {
ogreRoot->loadPlugin("RenderSystem_GL");
}
catch(Exception& e) {
LogManager::getSingleton().logMessage(String("Unable to create OpenGL RenderSystem: ") + e.getFullDescription());
}
try {
ogreRoot->loadPlugin("Plugin_CgProgramManager");
}
catch(Exception& e) {
LogManager::getSingleton().logMessage(String("Unable to create CG Program manager RenderSystem: ") + e.getFullDescription());
}
}