WORD desktop_gammaramp[3][256]; // jitgamma
qboolean gammaramp_supported;
void printgammaramp () // for debugging
{
FILE *blah;
int i;
blah = fopen("C:/gammaramp.txt","w");
for(i=0;i<256;i++)
fprintf(blah,"%d %d %d\n", desktop_gammaramp[0], desktop_gammaramp[1], desktop_gammaramp[2]);
}
void VID_BackupGamma() // jitgamma
{
HDC hdc;
hdc = GetDC (GetDesktopWindow());
gammaramp_supported = GetDeviceGammaRamp (hdc, &desktop_gammaramp[0][0]);
printgammaramp();
ReleaseDC (GetDesktopWindow(), hdc);
}
void VID_RestoreGamma() // jitgamma
{
if(gammaramp_supported)
{
HDC hdc;
hdc = GetDC (GetDesktopWindow());
SetDeviceGammaRamp (hdc, &desktop_gammaramp[0][0]);
ReleaseDC (GetDesktopWindow(), hdc);
}
}
</pre>
I''ll go into the driver settings and crank the red channel way up, for example, then run quake2, and when I quit, the gamma ramp goes back to the default settings (red isn''t bright).
Here''s what gammaramp.txt <i>always</i> looks like:
0 0 0
256 256 256
512 512 512
768 768 768
1024 1024 1024
…
64768 64768 64768
65024 65024 65024
65280 65280 65280
Any ideas? </i>
GetDeviceGammaRamp() not returning proper gammaramp
I''m fiddling with using gammaramps in Quake2, but I''ve run into a problem with saving the desktop gammaramp settings. It seems to always use the standard, straight ramp, no matter what color correction settings I have set in the drivers.
Here''s my code:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement