From 658d44cb461c2c60ce86ab48efa918f242c33196 Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 20 Apr 2006 01:47:26 +0000 Subject: [PATCH] added GL_AlphaTest function to enable/disable GL_ALPHA_TEST git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6313 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 18 ++++++++++++++++++ gl_backend.h | 1 + 2 files changed, 19 insertions(+) diff --git a/gl_backend.c b/gl_backend.c index a3b6747d..ca2b7104 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -396,6 +396,7 @@ static struct gl_state_s GLboolean depthmask; int colormask; // stored as bottom 4 bits: r g b a (3 2 1 0 order) int depthtest; + int alphatest; int scissortest; unsigned int unit; unsigned int clientunit; @@ -503,6 +504,7 @@ void GL_Backend_ResetState(void) { memset(&gl_state, 0, sizeof(gl_state)); gl_state.depthtest = true; + gl_state.alphatest = false; gl_state.blendfunc1 = GL_ONE; gl_state.blendfunc2 = GL_ZERO; gl_state.blend = false; @@ -624,6 +626,22 @@ void GL_DepthTest(int state) } } +void GL_AlphaTest(int state) +{ + if (gl_state.alphatest != state) + { + gl_state.alphatest = state; + if (gl_state.alphatest) + { + qglEnable(GL_ALPHA_TEST);CHECKGLERROR + } + else + { + qglDisable(GL_ALPHA_TEST);CHECKGLERROR + } + } +} + void GL_ColorMask(int r, int g, int b, int a) { int state = r*8 + g*4 + b*2 + a*1; diff --git a/gl_backend.h b/gl_backend.h index c7fba5ec..9a9be676 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -17,6 +17,7 @@ void GL_SetupView_Mode_Ortho(double x1, double y1, double x2, double y2, double void GL_BlendFunc(int blendfunc1, int blendfunc2); void GL_DepthMask(int state); void GL_DepthTest(int state); +void GL_AlphaTest(int state); void GL_ColorMask(int r, int g, int b, int a); void GL_Color(float cr, float cg, float cb, float ca); void GL_TransformToScreen(const vec4_t in, vec4_t out); -- 2.39.2