One fo the frustrations for a lot of users of Quake is the lack of gamma adjustment, meaning they have to adjust their monitor everytime they want to play Quake (and yes I know some cards have OpenGL settings seperate to desktop, but not all) I remembered an old bit of code of LordHavoc's that placed a blended white quad over the screen, giving more of a contrast change than a gamma change, but the idea was solid. So I sat down and hacked around with it for a while, and got a working gamma adjuster! This has only been tested on Geforce and TNT2 cards so far, so may not work for everyone In GL_RMAIN.C, at the top, just after the other variable definitions paste in this: extern cvar_t v_gamma; // muff // idea originally nicked from LordHavoc // re-worked + extended - muff 5 Feb 2001 // called inside polyblend void DoGamma() { if (v_gamma.value < 0.2) v_gamma.value = 0.2; if (v_gamma.value >= 1) { v_gamma.value = 1; return; } //believe it or not this actually does brighten the picture!! glBlendFunc ( GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); glColor4f (1, 1, 1, v_gamma.value); glBegin (GL_QUADS); glVertex3f (10, 100, 100); glVertex3f (10, -100, 100); glVertex3f (10, -100, -100); glVertex3f (10, 100, -100); //if we do this twice, we double the brightening effect for a wider range of gamma's glVertex3f (11, 100, 100); glVertex3f (11, -100, 100); glVertex3f (11, -100, -100); glVertex3f (11, 100, -100); glEnd (); } //some code from LordHavoc early DP version void R_PolyBlend (void) { if (!gl_polyblend.value) return; GL_DisableMultitexture(); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable (GL_BLEND); glDisable (GL_DEPTH_TEST); glDisable (GL_TEXTURE_2D); glLoadIdentity (); glRotatef (-90, 1, 0, 0); // put Z going up glRotatef (90, 0, 0, 1); // put Z going up if (v_blend[3]) { glColor4fv (v_blend); glBegin (GL_QUADS); glVertex3f (10, 100, 100); glVertex3f (10, -100, 100); glVertex3f (10, -100, -100); glVertex3f (10, 100, -100); glEnd (); } //gamma trick based on LordHavoc - muff if (v_gamma.value != 1) DoGamma(); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable (GL_BLEND); // muff glEnable (GL_TEXTURE_2D); glEnable (GL_ALPHA_TEST); //muff } You should now have a working gamma adjuster. Enjoy, muff |