From b8722c611ffaabde301f3134c1c8d76e64e3b02f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 12:10:49 +0000 Subject: Fixed Bug in Reflection Code that Causes wrong Depth Test when drawing Text git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@84 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 8 ++++++-- Game/Code/Menu/UMenuStatic.pas | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index f4f8e1a8..3a871c5f 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -179,12 +179,12 @@ begin //Bind Tex and GL Attributes glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); + glDepthRange(0, 10); glDepthFunc(GL_LEQUAL); - //glDepthFunc(GL_GEQUAL); glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //glBlendFunc(GL_SRC_COLOR, GL_ZERO); glBindTexture(GL_TEXTURE_2D, TexNum); //Draw @@ -209,6 +209,10 @@ begin glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); end; end; diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index c19e6abc..2a5e1e93 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -25,6 +25,7 @@ var Pet: integer; begin if Visible then + begin DrawTexture(Texture); //Reflection Mod @@ -35,12 +36,12 @@ begin //Bind Tex and GL Attributes glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); + glDepthRange(0, 10); glDepthFunc(GL_LEQUAL); - //glDepthFunc(GL_GEQUAL); glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //glBlendFunc(GL_SRC_COLOR, GL_ZERO); glBindTexture(GL_TEXTURE_2D, TexNum); //Draw @@ -51,13 +52,13 @@ begin //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX1*TexW, 0.5); glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX2*TexW, 0.5); glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right @@ -65,9 +66,13 @@ begin glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); end; end; - + end; end; constructor TStatic.Create(Textura: TTexture); -- cgit v1.2.3