Original Post
I'm trying to get gamma working in my application for DirectX 9. I'm using C#. I have the following code: The line saying "ramp.SetRed(GammaLevel);" returns an "ArgumentException was unhandled" ... "Parameter : value" I've been unable to figure out what I'm doing wrong. Can anybody notice why this code returns an error? Also with the SwapChain parameter in the SetGammaRamp method, what should this value be? I just made it -1. Does it matter?
protected void SetGamma()
{
short[] GammaLevel = new short[255];
Microsoft.DirectX.Direct3D.GammaRamp ramp = new Microsoft.DirectX.Direct3D.GammaRamp();
for (int i = 0; i < 255; i++)
{
// Make the screen pitch black
GammaLevel = 0;
}
ramp.SetRed(GammaLevel);
ramp.SetGreen(GammaLevel);
ramp.SetBlue(GammaLevel);
swGraphics.D3DDev.SetGammaRamp(-1, false, ramp);
}