mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 04:30:38 +00:00
A bit of fun with gamma.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1942 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
8e7eda07e6
commit
bc1f25a11b
1 changed files with 47 additions and 24 deletions
|
@ -203,6 +203,8 @@ BOOL (WINAPI *qSwapBuffers)(HDC);
|
|||
|
||||
BOOL (WINAPI *qwglSwapIntervalEXT) (int);
|
||||
|
||||
BOOL (APIENTRY *qGetDeviceGammaRamp)(HDC hDC, GLvoid *ramp);
|
||||
BOOL (APIENTRY *qSetDeviceGammaRamp)(HDC hDC, GLvoid *ramp);
|
||||
|
||||
qboolean GLInitialise (char *renderer)
|
||||
{
|
||||
|
@ -258,6 +260,12 @@ qboolean GLInitialise (char *renderer)
|
|||
qwglMakeCurrent = (void *)getwglfunc("wglMakeCurrent");
|
||||
qSwapBuffers = SwapBuffers;
|
||||
|
||||
qGetDeviceGammaRamp = (void *)getglfunc("wglGetDeviceGammaRamp3DFX");
|
||||
qSetDeviceGammaRamp = (void *)getglfunc("wglSetDeviceGammaRamp3DFX");
|
||||
|
||||
if (!qGetDeviceGammaRamp) qGetDeviceGammaRamp = (void*)GetDeviceGammaRamp;
|
||||
if (!qSetDeviceGammaRamp) qSetDeviceGammaRamp = (void*)SetDeviceGammaRamp;
|
||||
|
||||
TRACE(("dbg: GLInitialise: got wgl funcs\n"));
|
||||
|
||||
return true;
|
||||
|
@ -631,16 +639,6 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
|
|||
|
||||
vid.recalc_refdef = 1;
|
||||
|
||||
maindc = GetDC(mainwindow);
|
||||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = GetDeviceGammaRamp(hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
gammaworks = GetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
|
||||
TRACE(("dbg: GLVID_SetMode: attaching gl\n"));
|
||||
if (!VID_AttachGL(info))
|
||||
{
|
||||
|
@ -648,6 +646,17 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
|
|||
return false;
|
||||
}
|
||||
TRACE(("dbg: GLVID_SetMode: attaching gl okay\n"));
|
||||
|
||||
maindc = GetDC(mainwindow);
|
||||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = qGetDeviceGammaRamp(hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
gammaworks = qGetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -948,11 +957,13 @@ void GLVID_ShiftPalette (unsigned char *palette)
|
|||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = SetDeviceGammaRamp (hDC, ramps);
|
||||
gammaworks = qSetDeviceGammaRamp (hDC, ramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
gammaworks = SetDeviceGammaRamp (maindc, ramps);
|
||||
{
|
||||
gammaworks = qSetDeviceGammaRamp (maindc, ramps);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -967,14 +978,21 @@ void VID_SetDefaultMode (void)
|
|||
|
||||
void GLVID_Shutdown (void)
|
||||
{
|
||||
if (vid_desktopgamma.value)
|
||||
if (qSetDeviceGammaRamp)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
SetDeviceGammaRamp(hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
qSetDeviceGammaRamp(hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
qSetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
}
|
||||
}
|
||||
else
|
||||
SetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
qSetDeviceGammaRamp = NULL;
|
||||
qGetDeviceGammaRamp = NULL;
|
||||
|
||||
gammaworks = false;
|
||||
|
||||
|
@ -1143,14 +1161,19 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
|
|||
|
||||
v_gamma.modified = true; //wham bam thanks.
|
||||
|
||||
if (vid_desktopgamma.value)
|
||||
if (qSetDeviceGammaRamp)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = SetDeviceGammaRamp (hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = qSetDeviceGammaRamp (hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
gammaworks = qSetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
}
|
||||
}
|
||||
else
|
||||
gammaworks = SetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
}
|
||||
|
||||
vid_hardwaregamma.modified = true;
|
||||
|
|
Loading…
Reference in a new issue