Skip to main content
gamedev.net
🔒 Locked

[.net] Gamma Problem

Started by Kryptus Oct 27, 2005 at 9:48 AM 0 replies 350+ views
Original Post
Kryptus
Kryptus
I'm trying to get gamma working in my application for DirectX 9. I'm using C#. I have the following code:

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);
        }

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?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.