From 6e6c60858a32af24a0c5c053e2b6bfd67387711e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 10 Apr 2003 18:25:17 +0000 Subject: [PATCH] consolidate Enable/DisableTextureWrapping --- stepmania/src/NoteDisplay.cpp | 4 ++-- stepmania/src/RageDisplay.cpp | 12 ++++-------- stepmania/src/RageDisplay.h | 3 +-- stepmania/src/Sprite.cpp | 6 ++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 8ce803262d..8f9cb88b28 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -391,7 +391,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float DISPLAY->SetTextureModeGlow(); else DISPLAY->SetTextureModeModulate(); - DISPLAY->DisableTextureWrapping(); + DISPLAY->EnableTextureWrapping(false); const float fFrameWidth = pBottomCap->GetUnzoomedWidth(); const float fFrameHeight = pBottomCap->GetUnzoomedHeight(); @@ -534,7 +534,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float DISPLAY->SetTextureModeGlow(); else DISPLAY->SetTextureModeModulate(); - DISPLAY->DisableTextureWrapping(); + DISPLAY->EnableTextureWrapping(false); const float fFrameWidth = pSprTopCap->GetUnzoomedWidth(); const float fFrameHeight = pSprTopCap->GetUnzoomedHeight(); diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index bac6ce5617..27c5dd168b 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -803,13 +803,9 @@ void RageDisplay::DisableZBuffer() { glDisable( GL_DEPTH_TEST ); } -void RageDisplay::EnableTextureWrapping() +void RageDisplay::EnableTextureWrapping(bool yes) { - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); -} -void RageDisplay::DisableTextureWrapping() -{ - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + GLenum mode = yes? GL_REPEAT:GL_CLAMP; + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, mode ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode ); } diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index e4c6a4dd3e..42865e6e36 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -65,8 +65,7 @@ public: bool ZBufferEnabled() const; void EnableZBuffer(); void DisableZBuffer(); - void EnableTextureWrapping(); - void DisableTextureWrapping(); + void EnableTextureWrapping(bool yes=true); void DrawQuad( const RageVertex v[4] ); // upper-left, upper-right, lower-left, lower-right void DrawQuads( const RageVertex v[], int iNumVerts ); diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index dcb0b964c8..30ccb8ec2d 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -257,6 +257,7 @@ void Sprite::DrawPrimitives() v[2].t = RageVector2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right v[3].t = RageVector2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right + /* XXX: Why don't we honor m_bTextureWrapping when using custom coords? */ DISPLAY->EnableTextureWrapping(); } else @@ -268,10 +269,7 @@ void Sprite::DrawPrimitives() v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right - if( m_bTextureWrapping ) - DISPLAY->EnableTextureWrapping(); - else - DISPLAY->DisableTextureWrapping(); + DISPLAY->EnableTextureWrapping(m_bTextureWrapping); } }