Original Post
Hello, I hope someone can help me with this: I am using Direct3D in C# to create a 3D demo. Things has gone smoothly untill now when I want to fade the whole scene to a specific color. I did some programming with Direct3D in C++ before, and I remember I used the Device::Clear function to fade the whole screen. Now, when I try this in C# I don't manage to make it work. The code for clearing the screen is: Note: The alpha variable is an interpolated int changing from 0 to 255.
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.FromArgb(alpha,
System.Drawing.Color.Black), 1.0f, 0); My RenderStates are as follows:
d3dDevice.RenderState.CullMode = Cull.None;
d3dDevice.RenderState.AlphaBlendEnable = true;
d3dDevice.RenderState.AlphaSourceBlend = Blend.SourceAlpha;
d3dDevice.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha;
d3dDevice.RenderState.ReferenceAlpha = 0x00;
d3dDevice.RenderState.FillMode = FillMode.Solid;
d3dDevice.RenderState.Lighting = true;
The only thing that happens is that the screen goes blank. No change in alpha. I am quite new to Direct3D, so I have probably just forgotten a renderstate or done some other n00b-messup:) Hope anyone here can help me out. Thanks.