Game brightness
Is there a way to increase the overall brightness in your game window without increasing lighting. Maybe a pixel format setting or something like that.
It''ll vary depending on the API you''re using, but searching your documentation for ''gamma'' should point you in the right direction. I''m not completely positive, but I think the gamma methods in D3D only work in full-screen mode. Good luck!
GetDeviceGammaRamp and SetDeviceGammaRamp are available via the GDI for HDC related use.
MSDN does not give me any examples of these commands other than the syntax:
BOOL WINAPI SetDeviceGammaRamp(
HDC hDC,
LPVOID lpRamp
);
What is the LPVOID data type? Can someone post an example of using GetDeviceGammaRamp() and SetDeviceGammaRamp().
I''m guessing you''d just call it like this:
if (GetDeviceGammaRamp(HDC, ???))
{
SetDeviceGammaRamp(HDC, ???)
}
Am I somewhat close to correct?
Thanks!
BOOL WINAPI SetDeviceGammaRamp(
HDC hDC,
LPVOID lpRamp
);
What is the LPVOID data type? Can someone post an example of using GetDeviceGammaRamp() and SetDeviceGammaRamp().
I''m guessing you''d just call it like this:
if (GetDeviceGammaRamp(HDC, ???))
{
SetDeviceGammaRamp(HDC, ???)
}
Am I somewhat close to correct?
Thanks!
First off, the HDC is kind of irrelevant since this only applies to the whole driver, i.e., you can''t apply it to just a window. So just use the DC for the desktop window (I''m assuming MS Windows btw. )
The LPVOID points to an array of 3*256 unsigned ints. 256 for the red channel, 256 for green, ...
It''s kind of tricky what''s going on. There''s a paper on the web somewhere that explains what gamma is in this context but I don''t have the link and I can''t remember the equation.
But, I have code! It''s something I hacked together a while back. It looks like poo but it worked at the time. Hope it helps.
The LPVOID points to an array of 3*256 unsigned ints. 256 for the red channel, 256 for green, ...
It''s kind of tricky what''s going on. There''s a paper on the web somewhere that explains what gamma is in this context but I don''t have the link and I can''t remember the equation.
But, I have code! It''s something I hacked together a while back. It looks like poo but it worked at the time. Hope it helps.
//-----------------------------------------------------------------------------// iGamma: ranges from -255 to +255; negatives make the screen "darker"//-----------------------------------------------------------------------------void AdjustGamma( int iGamma ){ HDC hDC = GetDC(GetDesktopWindow()); bool bMinus = iGamma < 0; if( bMinus ) iGamma = -iGamma; iGamma = min(max(iGamma, 0), 255); if( hDC ) { const int iNum = 256; struct sRamp { WORD wRed[iNum]; WORD wGreen[iNum]; WORD wBlue[iNum]; } wRamp; if( GetDeviceGammaRamp(hDC, (LPVOID)&wRamp) ) { for( int i = 0; i < iNum; i++ ) { if( bMinus ) { wRamp.wRed[i] = (255 - iGamma)*(i); wRamp.wGreen[i] = (255 - iGamma)*(i); wRamp.wBlue[i] = (255 - iGamma)*(i); } else { wRamp.wRed[i] = 65535 - (255 - iGamma)*(255 - i); wRamp.wGreen[i] = 65535 - (255 - iGamma)*(255 - i); wRamp.wBlue[i] = 65535 - (255 - iGamma)*(255 - i); } } BOOL bRet = SetDeviceGammaRamp(hDC, (LPVOID)&wRamp); } ReleaseDC(GetDesktopWindow(), hDC); }}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement