qglColorMask(1, 1, 1, 1);CHECKGLERROR
qglAlphaFunc(gl_state.alphafunc, gl_state.alphafuncvalue);CHECKGLERROR
- qglDisable((vid_multisampling.integer && r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
+ qglDisable((r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
qglBlendFunc(gl_state.blendfunc1, gl_state.blendfunc2);CHECKGLERROR
qglDisable(GL_BLEND);CHECKGLERROR
qglCullFace(gl_state.cullface);CHECKGLERROR
CHECKGLERROR
if (gl_state.alphatest)
{
- qglEnable((vid_multisampling.integer && r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
+ qglEnable((r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
}
else
{
- qglDisable((vid_multisampling.integer && r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
+ qglDisable((r_transparent_alphatocoverage.integer) ? GL_SAMPLE_ALPHA_TO_COVERAGE_ARB : GL_ALPHA_TEST);CHECKGLERROR
}
break;
case RENDERPATH_D3D9:
matrix4x4_t tempmatrix;
r_waterstate_waterplane_t *waterplane = (r_waterstate_waterplane_t *)surfacewaterplane;
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
- {
permutation |= SHADERPERMUTATION_ALPHAKILL;
- GL_AlphaTest(true);
- }
- else
- GL_AlphaTest(false);
if (rsurface.texture->r_water_waterscroll[0] && rsurface.texture->r_water_waterscroll[1])
permutation |= SHADERPERMUTATION_NORMALMAPSCROLLBLEND; // todo: make generic
if (rsurfacepass == RSURFPASS_BACKGROUND)
GL_DepthMask(true);
R_SetupShader_Surface(vec3_origin, (rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT) != 0, 1, 1, rsurface.texture->specularscale, RSURFPASS_DEFERREDGEOMETRY, texturenumsurfaces, texturesurfacelist, NULL);
RSurf_DrawBatch();
- return;
}
// bind lightmap texture
// render surface batch normally
GL_DepthMask(writedepth && !(rsurface.texture->currentmaterialflags & MATERIALFLAG_BLENDED));
R_SetupShader_Surface(vec3_origin, (rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT) != 0, 1, 1, rsurface.texture->specularscale, RSURFPASS_BASE, texturenumsurfaces, texturesurfacelist, NULL);
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
+ GL_AlphaTest(true);
RSurf_DrawBatch();
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
+ GL_AlphaTest(false);
}
static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, const msurface_t **texturesurfacelist, qboolean writedepth)
CHECKGLERROR
R_Mesh_ResetTextureState();
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_AlphaTest(false);
GL_DepthRange(0, 1);
GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
GL_DepthTest(true);
// ARB2 GLSL shader path (GFFX5200, Radeon 9500)
R_SetupShader_Surface(lightcolor, false, ambientscale, diffusescale, specularscale, RSURFPASS_RTLIGHT, texturenumsurfaces, texturesurfacelist, NULL);
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
+ {
GL_DepthFunc(GL_EQUAL);
+ GL_AlphaTest(true);
+ }
RSurf_DrawBatch();
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
+ {
GL_DepthFunc(GL_LEQUAL);
+ GL_AlphaTest(false);
+ }
}
static void R_Shadow_RenderLighting_Light_Vertex_Pass(int firstvertex, int numvertices, int numtriangles, const int *element3i, vec3_t diffusecolor2, vec3_t ambientcolor2)
vid_usinghidecursor = false;
// enable multisampling
- if (mode->samples > 1 && vid_multisampling.integer)
+ if (vid_multisampling.integer)
{
if (vid.support.arb_multisample)
+ {
qglEnable(GL_MULTISAMPLE_ARB);
+ // it seems that enabling GL_MULTISAMPLE_ARB forces antialiasing to always work, fix the cvar as well
+ // make sure vid_sample is at least 2 to make things correct
+ if (vid_samples.integer < 2)
+ Cvar_SetValueQuick(&vid_samples, 0);
+ }
else
{
Cvar_SetValueQuick(&vid_multisampling, 0);