exceptions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -89,30 +89,26 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID)
|
||||
|
||||
for( unsigned i=0; ret==NULL && i<DriversToTry.size(); ++i )
|
||||
{
|
||||
try {
|
||||
Driver = DriversToTry[i];
|
||||
LOG->Trace("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)
|
||||
|
||||
Reference in New Issue
Block a user