RageDisplay_Legacy style cleanup.
This commit is contained in:
+14
-23
@@ -242,7 +242,7 @@ static void FixLittleEndian()
|
|||||||
|
|
||||||
static void TurnOffHardwareVBO()
|
static void TurnOffHardwareVBO()
|
||||||
{
|
{
|
||||||
if( glBindBufferARB )
|
if (GLEW_ARB_vertex_buffer_object)
|
||||||
{
|
{
|
||||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||||
@@ -333,7 +333,7 @@ GLhandleARB CompileShader( GLenum ShaderType, RString sFile, vector<RString> asD
|
|||||||
GLhandleARB LoadShader( GLenum ShaderType, RString sFile, vector<RString> asDefines )
|
GLhandleARB LoadShader( GLenum ShaderType, RString sFile, vector<RString> asDefines )
|
||||||
{
|
{
|
||||||
// Don't do anything here if not the hardware/driver can't do it!
|
// Don't do anything here if not the hardware/driver can't do it!
|
||||||
if( !GLEW_ARB_fragment_shader && ShaderType == GL_FRAGMENT_SHADER_ARB )
|
if (!GLEW_ARB_fragment_program && GLEW_ARB_shading_language_100 && ShaderType == GL_FRAGMENT_SHADER_ARB)
|
||||||
return 0;
|
return 0;
|
||||||
if (!GLEW_ARB_vertex_shader && ShaderType == GL_VERTEX_SHADER_ARB)
|
if (!GLEW_ARB_vertex_shader && ShaderType == GL_VERTEX_SHADER_ARB)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -559,18 +559,6 @@ static void CheckPalettedTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glColorTableEXT == NULL )
|
|
||||||
{
|
|
||||||
sError = "glColorTableEXT missing";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( glGetColorTableParameterivEXT == NULL )
|
|
||||||
{
|
|
||||||
sError = "glGetColorTableParameterivEXT missing";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check to see if paletted textures really work. */
|
/* Check to see if paletted textures really work. */
|
||||||
GLenum glTexFormat = g_GLPixFmtInfo[PixelFormat_PAL].internalfmt;
|
GLenum glTexFormat = g_GLPixFmtInfo[PixelFormat_PAL].internalfmt;
|
||||||
GLenum glImageFormat = g_GLPixFmtInfo[PixelFormat_PAL].format;
|
GLenum glImageFormat = g_GLPixFmtInfo[PixelFormat_PAL].format;
|
||||||
@@ -681,7 +669,7 @@ void SetupExtensions()
|
|||||||
glewInit();
|
glewInit();
|
||||||
|
|
||||||
g_iMaxTextureUnits = 1;
|
g_iMaxTextureUnits = 1;
|
||||||
if( glActiveTextureARB != NULL )
|
if (GLEW_ARB_multitexture)
|
||||||
glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, (GLint *) &g_iMaxTextureUnits );
|
glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, (GLint *) &g_iMaxTextureUnits );
|
||||||
|
|
||||||
CheckPalettedTextures();
|
CheckPalettedTextures();
|
||||||
@@ -894,7 +882,7 @@ static void SetupVertices( const RageSpriteVertex v[], int iNumVerts )
|
|||||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, Texture );
|
glTexCoordPointer( 2, GL_FLOAT, 0, Texture );
|
||||||
|
|
||||||
if( glClientActiveTextureARB != NULL )
|
if (GLEW_ARB_multitexture)
|
||||||
{
|
{
|
||||||
glClientActiveTextureARB( GL_TEXTURE1_ARB );
|
glClientActiveTextureARB( GL_TEXTURE1_ARB );
|
||||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
@@ -1285,6 +1273,7 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const
|
|||||||
glGetBooleanv( GL_TEXTURE_GEN_S, &bTextureGenS );
|
glGetBooleanv( GL_TEXTURE_GEN_S, &bTextureGenS );
|
||||||
GLboolean bTextureGenT;
|
GLboolean bTextureGenT;
|
||||||
glGetBooleanv( GL_TEXTURE_GEN_T, &bTextureGenT );
|
glGetBooleanv( GL_TEXTURE_GEN_T, &bTextureGenT );
|
||||||
|
|
||||||
if (bLighting || bTextureGenS || bTextureGenT)
|
if (bLighting || bTextureGenS || bTextureGenT)
|
||||||
{
|
{
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
@@ -1369,7 +1358,7 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const
|
|||||||
|
|
||||||
RageCompiledGeometry* RageDisplay_Legacy::CreateCompiledGeometry()
|
RageCompiledGeometry* RageDisplay_Legacy::CreateCompiledGeometry()
|
||||||
{
|
{
|
||||||
if( glGenBuffersARB )
|
if (GLEW_ARB_vertex_buffer_object)
|
||||||
return new RageCompiledGeometryHWOGL;
|
return new RageCompiledGeometryHWOGL;
|
||||||
else
|
else
|
||||||
return new RageCompiledGeometrySWOGL;
|
return new RageCompiledGeometrySWOGL;
|
||||||
@@ -1549,7 +1538,7 @@ void RageDisplay_Legacy::DrawLineStripInternal( const RageSpriteVertex v[], int
|
|||||||
static bool SetTextureUnit( TextureUnit tu )
|
static bool SetTextureUnit( TextureUnit tu )
|
||||||
{
|
{
|
||||||
// If multitexture isn't supported, ignore all textures except for 0.
|
// If multitexture isn't supported, ignore all textures except for 0.
|
||||||
if( glActiveTextureARB == NULL )
|
if (GLEW_ARB_multitexture)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((int) tu > g_iMaxTextureUnits)
|
if ((int) tu > g_iMaxTextureUnits)
|
||||||
@@ -1571,7 +1560,7 @@ void RageDisplay_Legacy::ClearAllTextures()
|
|||||||
|
|
||||||
int RageDisplay_Legacy::GetNumTextureUnits()
|
int RageDisplay_Legacy::GetNumTextureUnits()
|
||||||
{
|
{
|
||||||
if( glActiveTextureARB == NULL )
|
if (GLEW_ARB_multitexture)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return g_iMaxTextureUnits;
|
return g_iMaxTextureUnits;
|
||||||
@@ -1666,7 +1655,7 @@ void RageDisplay_Legacy::SetTextureFiltering( TextureUnit tu, bool b )
|
|||||||
|
|
||||||
void RageDisplay_Legacy::SetEffectMode( EffectMode effect )
|
void RageDisplay_Legacy::SetEffectMode( EffectMode effect )
|
||||||
{
|
{
|
||||||
if( glUseProgramObjectARB == NULL )
|
if (!GLEW_ARB_fragment_program && !GLEW_ARB_shading_language_100)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GLhandleARB hShader = 0;
|
GLhandleARB hShader = 0;
|
||||||
@@ -1782,7 +1771,7 @@ void RageDisplay_Legacy::SetBlendMode( BlendMode mode )
|
|||||||
DEFAULT_FAIL( mode );
|
DEFAULT_FAIL( mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glBlendFuncSeparateEXT != NULL )
|
if (GLEW_EXT_blend_equation_separate)
|
||||||
glBlendFuncSeparateEXT( iSourceRGB, iDestRGB, iSourceAlpha, iDestAlpha );
|
glBlendFuncSeparateEXT( iSourceRGB, iDestRGB, iSourceAlpha, iDestAlpha );
|
||||||
else
|
else
|
||||||
glBlendFunc( iSourceRGB, iDestRGB );
|
glBlendFunc( iSourceRGB, iDestRGB );
|
||||||
@@ -1883,8 +1872,10 @@ void RageDisplay_Legacy::SetMaterial(
|
|||||||
|
|
||||||
void RageDisplay_Legacy::SetLighting( bool b )
|
void RageDisplay_Legacy::SetLighting( bool b )
|
||||||
{
|
{
|
||||||
if( b ) glEnable( GL_LIGHTING );
|
if (b)
|
||||||
else glDisable( GL_LIGHTING );
|
glEnable(GL_LIGHTING);
|
||||||
|
else
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_Legacy::SetLightOff( int index )
|
void RageDisplay_Legacy::SetLightOff( int index )
|
||||||
|
|||||||
Reference in New Issue
Block a user