exceptions
This commit is contained in:
@@ -358,7 +358,7 @@ static void LogGLXDebugInformation()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRenderer )
|
RageDisplay_OGL::RageDisplay_OGL()
|
||||||
{
|
{
|
||||||
LOG->Trace( "RageDisplay_OGL::RageDisplay_OGL()" );
|
LOG->Trace( "RageDisplay_OGL::RageDisplay_OGL()" );
|
||||||
LOG->MapLog("renderer", "Current renderer: OpenGL");
|
LOG->MapLog("renderer", "Current renderer: OpenGL");
|
||||||
@@ -366,15 +366,17 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen
|
|||||||
FixLilEndian();
|
FixLilEndian();
|
||||||
InitStringMap();
|
InitStringMap();
|
||||||
|
|
||||||
|
wind = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRenderer )
|
||||||
|
{
|
||||||
wind = MakeLowLevelWindow();
|
wind = MakeLowLevelWindow();
|
||||||
|
|
||||||
bool bIgnore = false;
|
bool bIgnore = false;
|
||||||
CString sError = SetVideoMode( p, bIgnore );
|
CString sError = SetVideoMode( p, bIgnore );
|
||||||
if( sError != "" )
|
if( sError != "" )
|
||||||
{
|
return sError;
|
||||||
delete wind;
|
|
||||||
RageException::ThrowNonfatal( sError );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log driver details
|
// Log driver details
|
||||||
LOG->Info("OGL Vendor: %s", glGetString(GL_VENDOR));
|
LOG->Info("OGL Vendor: %s", glGetString(GL_VENDOR));
|
||||||
@@ -389,12 +391,9 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen
|
|||||||
if( IsSoftwareRenderer() )
|
if( IsSoftwareRenderer() )
|
||||||
{
|
{
|
||||||
if( !bAllowUnacceleratedRenderer )
|
if( !bAllowUnacceleratedRenderer )
|
||||||
{
|
return
|
||||||
delete wind;
|
|
||||||
RageException::ThrowNonfatal(
|
|
||||||
"Your system is reporting that OpenGL hardware acceleration is not available. "
|
"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!");
|
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
|
* 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!) */
|
* around--if GLDirect can do it, so can we!) */
|
||||||
if( !strncmp( (const char *) glGetString(GL_RENDERER), "GLDirect", 8 ) )
|
if( !strncmp( (const char *) glGetString(GL_RENDERER), "GLDirect", 8 ) )
|
||||||
{
|
return "GLDirect was detected. GLDirect is not compatible with StepMania, and should be disabled.\n";
|
||||||
delete wind;
|
|
||||||
RageException::ThrowNonfatal( "GLDirect was detected. GLDirect is not compatible with StepMania, and should be disabled.\n" );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
if( !glXIsDirect( g_X11Display, glXGetCurrentContext() ) )
|
if( !glXIsDirect( g_X11Display, glXGetCurrentContext() ) )
|
||||||
{
|
{
|
||||||
if( !bAllowUnacceleratedRenderer )
|
if( !bAllowUnacceleratedRenderer )
|
||||||
{
|
return "Your system is reporting that direct rendering is not available. "
|
||||||
delete wind;
|
|
||||||
RageException::ThrowNonfatal(
|
|
||||||
"Your system is reporting that direct rendering is not available. "
|
|
||||||
"Please obtain an updated driver from your video card manufacturer." );
|
"Please obtain an updated driver from your video card manufacturer." );
|
||||||
}
|
|
||||||
LOG->Warn("Direct rendering is not enabled!");
|
LOG->Warn("Direct rendering is not enabled!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -430,6 +423,8 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRen
|
|||||||
glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &g_line_granularity);
|
glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &g_line_granularity);
|
||||||
glGetFloatv(GL_POINT_SIZE_RANGE, g_point_range);
|
glGetFloatv(GL_POINT_SIZE_RANGE, g_point_range);
|
||||||
glGetFloatv(GL_POINT_SIZE_GRANULARITY, &g_point_granularity);
|
glGetFloatv(GL_POINT_SIZE_GRANULARITY, &g_point_granularity);
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(UNIX) && defined(HAVE_LIBXTST)
|
#if defined(UNIX) && defined(HAVE_LIBXTST)
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
class RageDisplay_OGL: public RageDisplay
|
class RageDisplay_OGL: public RageDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageDisplay_OGL( VideoModeParams params, bool bAllowUnacceleratedRenderer );
|
RageDisplay_OGL();
|
||||||
virtual ~RageDisplay_OGL();
|
virtual ~RageDisplay_OGL();
|
||||||
|
CString Init( VideoModeParams p, bool bAllowUnacceleratedRenderer );
|
||||||
void Update(float fDeltaTime);
|
void Update(float fDeltaTime);
|
||||||
|
|
||||||
bool IsSoftwareRenderer();
|
bool IsSoftwareRenderer();
|
||||||
|
|||||||
@@ -705,13 +705,12 @@ RageDisplay *CreateDisplay()
|
|||||||
if( sRenderer.CompareNoCase("opengl")==0 )
|
if( sRenderer.CompareNoCase("opengl")==0 )
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_OPENGL)
|
#if defined(SUPPORT_OPENGL)
|
||||||
error += "Initializing OpenGL...\n";
|
RageDisplay_OGL *pRet = new RageDisplay_OGL;
|
||||||
try {
|
CString sError = pRet->Init( params, PREFSMAN->m_bAllowUnacceleratedRenderer );
|
||||||
return new RageDisplay_OGL( params, PREFSMAN->m_bAllowUnacceleratedRenderer );
|
if( sError == "" )
|
||||||
} catch(RageException e) {
|
return pRet;
|
||||||
error += CString(e.what()) + "\n";
|
error += "Initializing OpenGL...\n" + sError;
|
||||||
continue;
|
delete pRet;
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( sRenderer.CompareNoCase("d3d")==0 )
|
else if( sRenderer.CompareNoCase("d3d")==0 )
|
||||||
|
|||||||
@@ -89,30 +89,26 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID)
|
|||||||
|
|
||||||
for( unsigned i=0; ret==NULL && i<DriversToTry.size(); ++i )
|
for( unsigned i=0; ret==NULL && i<DriversToTry.size(); ++i )
|
||||||
{
|
{
|
||||||
try {
|
Driver = DriversToTry[i];
|
||||||
Driver = DriversToTry[i];
|
LOG->Trace("Initializing driver: %s", Driver.c_str());
|
||||||
LOG->Trace("Initializing driver: %s", Driver.c_str());
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
if (!Driver.CompareNoCase("DShow")) ret = new MovieTexture_DShow(ID);
|
if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FFMPEG
|
#ifdef HAVE_FFMPEG
|
||||||
if (!Driver.CompareNoCase("FFMpeg")) ret = new MovieTexture_FFMpeg(ID);
|
if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID);
|
||||||
#endif
|
#endif
|
||||||
if (!Driver.CompareNoCase("Null")) ret = new MovieTexture_Null(ID);
|
if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID);
|
||||||
if( ret == NULL )
|
if( ret == NULL )
|
||||||
{
|
{
|
||||||
LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() );
|
LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString sError = ret->Init();
|
CString sError = ret->Init();
|
||||||
if( sError != "" )
|
if( sError != "" )
|
||||||
{
|
{
|
||||||
LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() );
|
LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() );
|
||||||
SAFE_DELETE( ret );
|
SAFE_DELETE( ret );
|
||||||
}
|
|
||||||
} catch (const RageException &e) {
|
|
||||||
LOG->Info("Couldn't load driver %s: %s", Driver.c_str(), e.what());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user