diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index d10988bdaf..2f38deb165 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -358,7 +358,7 @@ static void LogGLXDebugInformation() #endif } -RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRenderer ) +RageDisplay_OGL::RageDisplay_OGL() { LOG->Trace( "RageDisplay_OGL::RageDisplay_OGL()" ); LOG->MapLog("renderer", "Current renderer: OpenGL"); @@ -366,15 +366,17 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen FixLilEndian(); InitStringMap(); + wind = NULL; +} + +CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRenderer ) +{ wind = MakeLowLevelWindow(); bool bIgnore = false; CString sError = SetVideoMode( p, bIgnore ); if( sError != "" ) - { - delete wind; - RageException::ThrowNonfatal( sError ); - } + return sError; // Log driver details LOG->Info("OGL Vendor: %s", glGetString(GL_VENDOR)); @@ -389,12 +391,9 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen if( IsSoftwareRenderer() ) { if( !bAllowUnacceleratedRenderer ) - { - delete wind; - RageException::ThrowNonfatal( + return "Your system is reporting that OpenGL hardware acceleration is not available. " - "Please obtain an updated driver from your video card manufacturer.\n\n" ); - } + "Please obtain an updated driver from your video card manufacturer.\n\n"; LOG->Warn("This is a software renderer!"); } @@ -404,22 +403,16 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen * too using Direct3D directly. (If we can't, it's a bug that we can work * around--if GLDirect can do it, so can we!) */ if( !strncmp( (const char *) glGetString(GL_RENDERER), "GLDirect", 8 ) ) - { - delete wind; - RageException::ThrowNonfatal( "GLDirect was detected. GLDirect is not compatible with StepMania, and should be disabled.\n" ); - } + return "GLDirect was detected. GLDirect is not compatible with StepMania, and should be disabled.\n"; #endif #if defined(UNIX) if( !glXIsDirect( g_X11Display, glXGetCurrentContext() ) ) { if( !bAllowUnacceleratedRenderer ) - { - delete wind; - RageException::ThrowNonfatal( - "Your system is reporting that direct rendering is not available. " + return "Your system is reporting that direct rendering is not available. " "Please obtain an updated driver from your video card manufacturer." ); - } + LOG->Warn("Direct rendering is not enabled!"); } #endif @@ -430,6 +423,8 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &g_line_granularity); glGetFloatv(GL_POINT_SIZE_RANGE, g_point_range); glGetFloatv(GL_POINT_SIZE_GRANULARITY, &g_point_granularity); + + return ""; } #if defined(UNIX) && defined(HAVE_LIBXTST) diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index ab6bb0acf1..c8874b3d39 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -6,8 +6,9 @@ class RageDisplay_OGL: public RageDisplay { public: - RageDisplay_OGL( VideoModeParams params, bool bAllowUnacceleratedRenderer ); + RageDisplay_OGL(); virtual ~RageDisplay_OGL(); + CString Init( VideoModeParams p, bool bAllowUnacceleratedRenderer ); void Update(float fDeltaTime); bool IsSoftwareRenderer(); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 3c0400935d..f6ff57f47f 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -705,13 +705,12 @@ RageDisplay *CreateDisplay() if( sRenderer.CompareNoCase("opengl")==0 ) { #if defined(SUPPORT_OPENGL) - error += "Initializing OpenGL...\n"; - try { - return new RageDisplay_OGL( params, PREFSMAN->m_bAllowUnacceleratedRenderer ); - } catch(RageException e) { - error += CString(e.what()) + "\n"; - continue; - }; + RageDisplay_OGL *pRet = new RageDisplay_OGL; + CString sError = pRet->Init( params, PREFSMAN->m_bAllowUnacceleratedRenderer ); + if( sError == "" ) + return pRet; + error += "Initializing OpenGL...\n" + sError; + delete pRet; #endif } else if( sRenderer.CompareNoCase("d3d")==0 ) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.cpp b/stepmania/src/arch/MovieTexture/MovieTexture.cpp index d096968ebd..67ae7fdca3 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture.cpp @@ -89,30 +89,26 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID) for( unsigned i=0; ret==NULL && iTrace("Initializing driver: %s", Driver.c_str()); + Driver = DriversToTry[i]; + LOG->Trace("Initializing driver: %s", Driver.c_str()); #ifdef _WINDOWS - if (!Driver.CompareNoCase("DShow")) ret = new MovieTexture_DShow(ID); + if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID); #endif #ifdef HAVE_FFMPEG - if (!Driver.CompareNoCase("FFMpeg")) ret = new MovieTexture_FFMpeg(ID); + if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID); #endif - if (!Driver.CompareNoCase("Null")) ret = new MovieTexture_Null(ID); - if( ret == NULL ) - { - LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() ); - continue; - } + if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID); + if( ret == NULL ) + { + LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() ); + continue; + } - CString sError = ret->Init(); - if( sError != "" ) - { - LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() ); - SAFE_DELETE( ret ); - } - } catch (const RageException &e) { - LOG->Info("Couldn't load driver %s: %s", Driver.c_str(), e.what()); + CString sError = ret->Init(); + if( sError != "" ) + { + LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() ); + SAFE_DELETE( ret ); } } if (!ret)