]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
prevent segfault caused by stringlistsort
[xonotic/darkplaces.git] / vid_shared.c
index 05f17f5309201565d2a87427886e2554de1bb5ca..c34f1c82e795f81da570e04bcf3546495bafb061 100644 (file)
@@ -1006,6 +1006,7 @@ void VID_CheckExtensions(void)
        vid.support.ext_texture_filter_anisotropic = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false);
        vid.support.ext_texture_srgb = GL_CheckExtension("GL_EXT_texture_sRGB", NULL, "-nosrgb", false);
        vid.support.arb_multisample = GL_CheckExtension("GL_ARB_multisample", multisamplefuncs, "-nomultisample", false);
+       vid.allowalphatocoverage = false;
 
 // COMMANDLINEOPTION: GL: -noshaders disables use of OpenGL 2.0 shaders (which allow pixel shader effects, can improve per pixel lighting performance and capabilities)
 // COMMANDLINEOPTION: GL: -noanisotropy disables GL_EXT_texture_filter_anisotropic (allows higher quality texturing)
@@ -1081,6 +1082,10 @@ void VID_CheckExtensions(void)
                vid.sRGBcapable2D = false;
                vid.sRGBcapable3D = true;
                vid.useinterleavedarrays = false;
+               Con_Printf("vid.support.arb_multisample %i\n", vid.support.arb_multisample);
+               Con_Printf("vid.mode.samples %i\n", vid.mode.samples);
+               Con_Printf("vid.support.gl20shaders %i\n", vid.support.gl20shaders);
+               vid.allowalphatocoverage = true; // but see below, it may get turned to false again if GL_SAMPLES_ARB is <= 1
        }
        else if (vid.support.arb_texture_env_combine && vid.texunits >= 2 && vid_gl13.integer)
        {
@@ -1106,6 +1111,19 @@ void VID_CheckExtensions(void)
                vid.useinterleavedarrays = false;
        }
 
+       // enable multisample antialiasing if possible
+       if(vid.support.arb_multisample)
+       {
+               int samples = 0;
+               qglGetIntegerv(GL_SAMPLES_ARB, &samples);
+               if (samples > 1)
+                       qglEnable(GL_MULTISAMPLE_ARB);
+               else
+                       vid.allowalphatocoverage = false;
+       }
+       else
+               vid.allowalphatocoverage = false;
+
        // VorteX: set other info (maybe place them in VID_InitMode?)
        Cvar_SetQuick(&gl_info_vendor, gl_vendor);
        Cvar_SetQuick(&gl_info_renderer, gl_renderer);
@@ -1450,8 +1468,8 @@ void VID_UpdateGamma(qboolean force, int rampsize)
                wantgamma = 0;
 #define BOUNDCVAR(cvar, m1, m2) c = &(cvar);f = bound(m1, c->value, m2);if (c->value != f) Cvar_SetValueQuick(c, f);
        BOUNDCVAR(v_gamma, 0.1, 5);
-       BOUNDCVAR(v_contrast, 1, 5);
-       BOUNDCVAR(v_brightness, 0, 0.8);
+       BOUNDCVAR(v_contrast, 0.2, 5);
+       BOUNDCVAR(v_brightness, -v_contrast.value * 0.8, 0.8);
        //BOUNDCVAR(v_contrastboost, 0.0625, 16);
        BOUNDCVAR(v_color_black_r, 0, 0.8);
        BOUNDCVAR(v_color_black_g, 0, 0.8);
@@ -1751,11 +1769,6 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate,
                        Cvar_SetValueQuick(&vid_refreshrate, vid.mode.refreshrate);
                Cvar_SetValueQuick(&vid_stereobuffer, vid.mode.stereobuffer);
 
-               // LordHavoc: disabled this code because multisampling is on by default if the framebuffer is multisampled
-//             // activate multisampling
-//             if (vid.mode.samples > 1)
-//                     GL_MultiSampling(true);
-
                return true;
        }
        else