move HasExtension into RageDisplay_OGL_Extensions
This commit is contained in:
@@ -81,9 +81,6 @@ int g_gluVersion;
|
||||
|
||||
static int g_iMaxTextureUnits = 0;
|
||||
|
||||
/* Available extensions: */
|
||||
set<string> 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<string> &ext)
|
||||
{
|
||||
const char *buf = (const char *)glGetString(GL_EXTENSIONS);
|
||||
|
||||
vector<CString> 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);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <set>
|
||||
|
||||
#if !defined(DARWIN)
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glu.h>
|
||||
@@ -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<string> 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<string> &ext )
|
||||
{
|
||||
const char *szBuf = (const char *) glGetString( GL_EXTENSIONS );
|
||||
|
||||
vector<CString> 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");
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user