mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-22 12:11:34 +00:00
hardware gamma support. I don't know how well it works (hard to tell on my
test box), but it doesn't crash :)
This commit is contained in:
parent
0fad122bc3
commit
1afaefd9dc
1 changed files with 37 additions and 3 deletions
|
@ -52,6 +52,10 @@
|
||||||
void GL_Common_Init_Cvars (void);
|
void GL_Common_Init_Cvars (void);
|
||||||
void CheckMultiTextureExtensions (void);
|
void CheckMultiTextureExtensions (void);
|
||||||
void VID_Init8bitPalette (void);
|
void VID_Init8bitPalette (void);
|
||||||
|
void VID_BuildGammaTable (double);
|
||||||
|
|
||||||
|
void VID_GetSystemGamma (void);
|
||||||
|
void VID_RestoreSystemGamma (void);
|
||||||
|
|
||||||
extern void (*vid_menudrawfn) (void);
|
extern void (*vid_menudrawfn) (void);
|
||||||
extern void (*vid_menukeyfn) (int);
|
extern void (*vid_menukeyfn) (int);
|
||||||
|
@ -104,6 +108,7 @@ qboolean DDActive;
|
||||||
// If you ever merge screen/gl_screen, don't forget this one
|
// If you ever merge screen/gl_screen, don't forget this one
|
||||||
qboolean scr_skipupdate;
|
qboolean scr_skipupdate;
|
||||||
|
|
||||||
|
static unsigned short system_gamma_ramp[3][256];
|
||||||
static vmode_t modelist[MAX_MODE_LIST];
|
static vmode_t modelist[MAX_MODE_LIST];
|
||||||
static int nummodes;
|
static int nummodes;
|
||||||
static vmode_t badmode;
|
static vmode_t badmode;
|
||||||
|
@ -560,6 +565,7 @@ VID_Shutdown (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (vid_initialized) {
|
if (vid_initialized) {
|
||||||
|
VID_RestoreSystemGamma ();
|
||||||
vid_canalttab = false;
|
vid_canalttab = false;
|
||||||
hRC = wglGetCurrentContext ();
|
hRC = wglGetCurrentContext ();
|
||||||
hDC = wglGetCurrentDC ();
|
hDC = wglGetCurrentDC ();
|
||||||
|
@ -1422,6 +1428,8 @@ VID_Init (unsigned char *palette)
|
||||||
DestroyWindow (hwnd_dialog);
|
DestroyWindow (hwnd_dialog);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
VID_GetSystemGamma ();
|
||||||
|
|
||||||
GL_Common_Init_Cvars ();
|
GL_Common_Init_Cvars ();
|
||||||
VID_InitGamma (palette);
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
@ -1602,5 +1610,31 @@ VID_SetCaption (char *text)
|
||||||
qboolean
|
qboolean
|
||||||
VID_SetGamma (double gamma)
|
VID_SetGamma (double gamma)
|
||||||
{
|
{
|
||||||
return false; //FIXME
|
int i;
|
||||||
|
unsigned short ramps[3][256];
|
||||||
|
HDC hdc = GetDC (NULL);
|
||||||
|
|
||||||
|
VID_BuildGammaTable (gamma);
|
||||||
|
for (i = 0; i < 255; i++) {
|
||||||
|
ramps[0][i] = ramps[1][i] = ramps[2][i] = gammatable[i] << 16;
|
||||||
|
}
|
||||||
|
i = SetDeviceGammaRamp(hdc, ramps);
|
||||||
|
ReleaseDC (NULL, hdc);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VID_GetSystemGamma (void)
|
||||||
|
{
|
||||||
|
HDC hdc = GetDC (NULL);
|
||||||
|
GetDeviceGammaRamp(hdc, &system_gamma_ramp[0][0]);
|
||||||
|
ReleaseDC (NULL, hdc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VID_RestoreSystemGamma (void)
|
||||||
|
{
|
||||||
|
HDC hdc = GetDC (NULL);
|
||||||
|
SetDeviceGammaRamp(hdc, &system_gamma_ramp[0][0]);
|
||||||
|
ReleaseDC (NULL, hdc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue