From 2c3c200d922cb528d3d815d12c69062b72b93a6b Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 11 Jan 2007 04:45:12 +0000 Subject: [PATCH] implemented detection of GL_EXT_blend_subtract git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6682 d7cf8633-e32d-0410-b094-e92efae38249 --- glquake.h | 17 +++++++++++++++++ vid_shared.c | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/glquake.h b/glquake.h index b27cd252..32b76f2d 100644 --- a/glquake.h +++ b/glquake.h @@ -399,6 +399,23 @@ extern int gl_support_clamptoedge; extern void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum); extern int gl_support_stenciltwoside; +//GL_EXT_blend_minmax +extern int gl_support_ext_blend_minmax; +#ifndef GL_FUNC_ADD_EXT +#define GL_FUNC_ADD_EXT 0x8006 // also supplied by GL_EXT_blend_subtract +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 // also supplied by GL_EXT_blend_subtract +extern void (GLAPIENTRY *qglBlendEquationEXT)(GLenum); // also supplied by GL_EXT_blend_subtract +#endif + +//GL_EXT_blend_subtract +extern int gl_support_ext_blend_subtract; +#ifndef GL_FUNC_SUBTRACT_EXT +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + //GL_ARB_texture_non_power_of_two extern int gl_support_arb_texture_non_power_of_two; diff --git a/vid_shared.c b/vid_shared.c index 200f4458..6599d711 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -44,6 +44,10 @@ int gl_support_anisotropy = false; int gl_max_anisotropy = 1; // GL_EXT_stencil_two_side int gl_support_stenciltwoside = false; +// GL_EXT_blend_minmax +int gl_support_ext_blend_minmax = false; +// GL_EXT_blend_subtract +int gl_support_ext_blend_subtract = false; // GL_ARB_shader_objects int gl_support_shader_objects = false; // GL_ARB_shading_language_100 @@ -248,6 +252,8 @@ void (GLAPIENTRY *qglPolygonStipple)(const GLubyte *mask); void (GLAPIENTRY *qglLineWidth)(GLfloat width); void (GLAPIENTRY *qglPointSize)(GLfloat size); +void (GLAPIENTRY *qglBlendEquationEXT)(GLenum); + void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum); void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj); @@ -519,6 +525,12 @@ static dllfunction_t stenciltwosidefuncs[] = {NULL, NULL} }; +static dllfunction_t blendequationfuncs[] = +{ + {"glBlendEquationEXT", (void **) &qglBlendEquationEXT}, + {NULL, NULL} +}; + static dllfunction_t shaderobjectsfuncs[] = { {"glDeleteObjectARB", (void **) &qglDeleteObjectARB}, @@ -635,6 +647,8 @@ void VID_CheckExtensions(void) gl_support_anisotropy = false; gl_max_anisotropy = 1; gl_support_stenciltwoside = false; + gl_support_ext_blend_minmax = false; + gl_support_ext_blend_subtract = false; gl_support_shader_objects = false; gl_support_shading_language_100 = false; gl_support_vertex_shader = false; @@ -692,6 +706,9 @@ void VID_CheckExtensions(void) if ((gl_support_anisotropy = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false))) qglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy); + gl_support_ext_blend_minmax = GL_CheckExtension("GL_EXT_blend_minmax", blendequationfuncs, "-noblendminmax", false); + gl_support_ext_blend_subtract = GL_CheckExtension("GL_EXT_blend_subtract", blendequationfuncs, "-noblendsubtract", false); + // COMMANDLINEOPTION: GL: -nostenciltwoside disables GL_EXT_stencil_two_side (accelerates shadow rendering) gl_support_stenciltwoside = GL_CheckExtension("GL_EXT_stencil_two_side", stenciltwosidefuncs, "-nostenciltwoside", false); -- 2.39.2