From 2c27caef0976690bf1ec1382c76e6df9f93abb2d Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 13 May 2012 17:14:34 +0200 Subject: [PATCH] Changed: #1275 Enable OpenGL ES driver in Ryzom client --- code/ryzom/client/src/client_cfg.cpp | 1 + code/ryzom/client/src/client_cfg.h | 2 +- code/ryzom/client/src/init.cpp | 34 ++++++++++++++++++---------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index e0ed33abe..081bc3ad5 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -841,6 +841,7 @@ void CClientConfig::setValues() if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto; else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL; else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D; + else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES; } else cfgWarning ("Default value used for 'Driver3D' !!!"); diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 3925aaf2d..9f4787062 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -53,7 +53,7 @@ using std::string; //--------------------------------------------------- struct CClientConfig { - enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D }; + enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D, OpenGLES }; enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 }; enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT }; diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a43dd97c0..ef48fe603 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -819,33 +819,43 @@ void prelogInit() nmsg = "Creating 3d driver..."; ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); - bool direct3D = false; + UDriver::TDriver driver = UDriver::OpenGl; #ifdef NL_OS_WINDOWS + uint icon = (uint)LoadIcon(HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)); +#else + uint icon = 0; +#endif // NL_OS_WINDOWS + switch(ClientCfg.Driver3D) { case CClientConfig::DrvAuto: +#ifdef NL_OS_WINDOWS { // Fallback to D3D for card other than nVidia std::string deviceName; uint64 drvVersion; - CSystemInfo::getVideoInfo( deviceName, drvVersion); + CSystemInfo::getVideoInfo(deviceName, drvVersion); strlwr(deviceName); - direct3D = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL; + driver = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL ? UDriver::Direct3d:UDriver::OpenGl; } break; - case CClientConfig::OpenGL: - direct3D = false; - break; case CClientConfig::Direct3D: - direct3D = true; + driver = UDriver::Direct3d; + break; +#endif // NL_OS_WINDOWS + case CClientConfig::OpenGL: + driver = UDriver::OpenGl; + break; + case CClientConfig::OpenGLES: + driver = UDriver::OpenGlEs; + break; + default: break; } - Driver = UDriver::createDriver ((uint)LoadIcon (HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)), direct3D); -#else // NL_OS_WINDOWS - Driver = UDriver::createDriver (); -#endif // NL_OS_WINDOWS + Driver = UDriver::createDriver(icon, driver); + if(Driver == NULL) { ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ()); @@ -1111,7 +1121,7 @@ void prelogInit() CBloomEffect::getInstance().setDriver(Driver); // init bloom effect - CBloomEffect::getInstance().init(!direct3D); + CBloomEffect::getInstance().init(driver != UDriver::Direct3d); nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000);