]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
fix line feeds
[xonotic/darkplaces.git] / vid_shared.c
index 873d43285c39bf3cca2bb5c64e7f0a2f3dd5274a..e6259b655914e5b4cc3266f98e44a332accdb22b 100644 (file)
@@ -198,6 +198,8 @@ cvar_t v_color_white_g = {CVAR_SAVE, "v_color_white_g", "1", "desired color of w
 cvar_t v_color_white_b = {CVAR_SAVE, "v_color_white_b", "1", "desired color of white"};
 cvar_t v_hwgamma = {CVAR_SAVE, "v_hwgamma", "0", "enables use of hardware gamma correction ramps if available (note: does not work very well on Windows2000 and above), values are 0 = off, 1 = attempt to use hardware gamma, 2 = use hardware gamma whether it works or not"};
 cvar_t v_glslgamma = {CVAR_SAVE, "v_glslgamma", "1", "enables use of GLSL to apply gamma correction ramps if available (note: overrides v_hwgamma)"};
+cvar_t v_glslgamma_2d = {CVAR_SAVE, "v_glslgamma_2d", "0", "applies GLSL gamma to 2d pictures (HUD, fonts)"};
+
 cvar_t v_psycho = {0, "v_psycho", "0", "easter egg"};
 
 // brand of graphics chip
@@ -1085,7 +1087,7 @@ void VID_CheckExtensions(void)
                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 = vid.support.arb_multisample && vid_samples.integer > 1 && 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)
        {
@@ -1110,9 +1112,19 @@ void VID_CheckExtensions(void)
                vid.sRGBcapable3D = false;
                vid.useinterleavedarrays = false;
        }
+
        // enable multisample antialiasing if possible
-       if (vid_samples.integer > 1 && vid.support.arb_multisample)
-               qglEnable(GL_MULTISAMPLE_ARB);
+       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);
@@ -1458,8 +1470,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);
@@ -1639,6 +1651,7 @@ void VID_Shared_Init(void)
 
        Cvar_RegisterVariable(&v_hwgamma);
        Cvar_RegisterVariable(&v_glslgamma);
+       Cvar_RegisterVariable(&v_glslgamma_2d);
 
        Cvar_RegisterVariable(&v_psycho);