diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 7e58b7f30e..adbb3b2c1c 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -81,9 +81,6 @@ int g_gluVersion; static int g_iMaxTextureUnits = 0; -/* Available extensions: */ -set g_glExts; - /* We don't actually use normals (we don't turn on lighting), there's just * no GL_T2F_C4F_V3F. */ const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F; @@ -268,17 +265,6 @@ static void FixLittleEndian() } -void GetGLExtensions(set &ext) -{ - const char *buf = (const char *)glGetString(GL_EXTENSIONS); - - vector lst; - split(buf, " ", lst); - - for(unsigned i = 0; i < lst.size(); ++i) - ext.insert(lst[i]); -} - static void FlushGLErrors() { /* Making an OpenGL call doesn't also flush the error state; if we happen @@ -557,17 +543,12 @@ RageDisplay_OGL::~RageDisplay_OGL() delete wind; } -bool HasExtension(CString ext) -{ - return g_glExts.find(ext) != g_glExts.end(); -} - static void CheckPalettedTextures() { CString error; do { - if( !HasExtension("GL_EXT_paletted_texture") ) + if( !GLExt.HasExtension("GL_EXT_paletted_texture") ) { error = "GL_EXT_paletted_texture missing"; break; @@ -687,7 +668,6 @@ void SetupExtensions() { const float fGLVersion = strtof( (const char *) glGetString(GL_VERSION), NULL ); g_glVersion = int(roundf(fGLVersion * 10)); - GetGLExtensions(g_glExts); const float fGLUVersion = strtof( (const char *) gluGetString(GLU_VERSION), NULL ); g_gluVersion = int(roundf(fGLUVersion * 10)); @@ -1766,7 +1746,7 @@ unsigned RageDisplay_OGL::CreateTexture( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); if( wind->GetVideoModeParams().bAnisotropicFiltering && - HasExtension("GL_EXT_texture_filter_anisotropic") ) + GLExt.HasExtension("GL_EXT_texture_filter_anisotropic") ) { GLfloat largest_supported_anisotropy; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy); diff --git a/stepmania/src/RageDisplay_OGL_Extensions.cpp b/stepmania/src/RageDisplay_OGL_Extensions.cpp index 6430ec8470..6f48a8f382 100644 --- a/stepmania/src/RageDisplay_OGL_Extensions.cpp +++ b/stepmania/src/RageDisplay_OGL_Extensions.cpp @@ -6,6 +6,8 @@ #include #endif +#include + #if !defined(DARWIN) # include # include @@ -19,11 +21,18 @@ #include "RageDisplay_OGL_Extensions.h" #include "RageLog.h" +#include "RageUtil.h" #include "arch/LowLevelWindow/LowLevelWindow.h" GLExt_t GLExt; -bool HasExtension( CString ext ); +/* Available extensions: */ +static set g_glExts; + +bool GLExt_t::HasExtension( const CString &sExt ) const +{ + return g_glExts.find(sExt) != g_glExts.end(); +} #define F(n) { (void **) &GLExt.n , #n } @@ -56,10 +65,23 @@ static bool LoadAllOrNothing( struct func_t *funcs, LowLevelWindow *pWind ) return false; } +static void GetGLExtensions( set &ext ) +{ + const char *szBuf = (const char *) glGetString( GL_EXTENSIONS ); + + vector asList; + split( szBuf, " ", asList ); + + for( unsigned i = 0; i < asList.size(); ++i ) + ext.insert( asList[i] ); +} + void GLExt_t::Load( LowLevelWindow *pWind ) { memset( this, 0, sizeof(*this) ); + GetGLExtensions( g_glExts ); + m_bEXT_texture_env_combine = HasExtension("GL_EXT_texture_env_combine"); m_bGL_EXT_bgra = HasExtension("GL_EXT_bgra"); diff --git a/stepmania/src/RageDisplay_OGL_Extensions.h b/stepmania/src/RageDisplay_OGL_Extensions.h index 792a225fef..ed040cd24d 100644 --- a/stepmania/src/RageDisplay_OGL_Extensions.h +++ b/stepmania/src/RageDisplay_OGL_Extensions.h @@ -51,6 +51,8 @@ struct GLExt_t int m_iShadingLanguageVersion; /* * 100 */ void Load( LowLevelWindow *pWind ); + + bool HasExtension( const CString &sExt ) const; }; extern GLExt_t GLExt;