public void SetGraphicsDeviceStates()
{
// SpriteBatch changes:
//_graphicsDevice.RenderState.CullMode = CullMode.CullCounterClockwiseFace;
//_graphicsDevice.RenderState.DepthBufferEnable = false;
//_graphicsDevice.RenderState.AlphaBlendEnable = true;
//_graphicsDevice.RenderState.AlphaBlendOperation = BlendFunction.Add;
//_graphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
//_graphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
//_graphicsDevice.RenderState.SeparateAlphaBlendEnabled = false;
//_graphicsDevice.RenderState.AlphaTestEnable = true;
//_graphicsDevice.RenderState.AlphaFunction = CompareFunction.Greater;
//_graphicsDevice.RenderState.ReferenceAlpha = 0;
//_graphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Clamp;
//_graphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Clamp;
//_graphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Linear;
//_graphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Linear;
//_graphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Linear;
//_graphicsDevice.SamplerStates[0].MipMapLevelOfDetailBias = 0.0f;
//_graphicsDevice.SamplerStates[0].MaxMipLevel = 0;
// Correct SpriteBatch changes:
_graphicsDevice.RenderState.DepthBufferEnable = true;
_graphicsDevice.RenderState.AlphaBlendEnable = false;
_graphicsDevice.RenderState.SourceBlend = Blend.One;
_graphicsDevice.RenderState.DestinationBlend = Blend.Zero;
_graphicsDevice.RenderState.AlphaTestEnable = false;
_graphicsDevice.RenderState.AlphaFunction = CompareFunction.Always;
_graphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
_graphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Wrap;
_graphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point;
_graphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point;
_graphicsDevice.SamplerStates[0].MipFilter = TextureFilter.None;
}
I have experience working with C++ and DirectX. I prefer working with C# and WPF. In my spare time I work with HTML, JS, CSS.
Showing posts with label Restore changes to default. Show all posts
Showing posts with label Restore changes to default. Show all posts
Thursday, May 13, 2010
XNA Restore SpriteBatch changes on GraphicsDevice
Restore SpriteBatch changes of RenderState and SamplerStates on GraphicsDevice to default:
Subscribe to:
Posts (Atom)