From ee0237101936ce9276e6951f224d42788d989f85 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 18 Apr 2005 05:41:39 +0000 Subject: [PATCH] Added an option to compleatly disable gamma ramps. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@961 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_vidlinuxglx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/engine/gl/gl_vidlinuxglx.c b/engine/gl/gl_vidlinuxglx.c index cfd9d1020..3af8251b1 100644 --- a/engine/gl/gl_vidlinuxglx.c +++ b/engine/gl/gl_vidlinuxglx.c @@ -70,7 +70,7 @@ static float old_windowed_mouse = 0; #ifdef WITH_VMODE -static qboolean vidmode_ext = false; +static int vidmode_ext = 0; static XF86VidModeModeInfo **vidmodes; static int num_vidmodes; static qboolean vidmode_active = false; @@ -715,14 +715,14 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) #ifdef WITH_VMODE //find out if it's supported on this pc. MajorVersion = MinorVersion = 0; - if (!XF86VidModeQueryVersion(vid_dpy, &MajorVersion, &MinorVersion)) + if (COM_CheckParm("-novmode") || !XF86VidModeQueryVersion(vid_dpy, &MajorVersion, &MinorVersion)) { - vidmode_ext = false; + vidmode_ext = 0; } else { Con_Printf("Using XF86-VidModeExtension Ver. %d.%d\n", MajorVersion, MinorVersion); - vidmode_ext = true; + vidmode_ext = MajorVersion; } #endif @@ -819,7 +819,20 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) XFlush(vid_dpy); #ifdef WITH_VMODE - origionalapplied = XF86VidModeGetGammaRamp(vid_dpy, scrnum, 256, origionalramps[0], origionalramps[1], origionalramps[2]); + if (vidmode_ext >= 2) + { + int rampsize = 256; + XF86VidModeGetGammaRampSize(vid_dpy, scrnum, &rampsize); + if (rampsize != 256) + { + origionalapplied = false; + Con_Printf("Gamma ramps are not of 256 componants.\n"); + } + else + origionalapplied = XF86VidModeGetGammaRamp(vid_dpy, scrnum, 256, origionalramps[0], origionalramps[1], origionalramps[2]); + } + else + origionalapplied = false; #endif ctx = qglXCreateContext(vid_dpy, visinfo, NULL, True);