So, I've got some older MDX code that is supposed to render some quads over some other scene stuff and blend the quad's texture with the rest of the scene. I have 2 problems. 1) I don't know all of the XNA equivalents; 2) What I'm using now in XNA doesn't blend properly (in fact, it doesn't blend at all, either it is full opaque or full transparent).
Here's the old MDX code:
// Set render states
device.SetRenderState( RenderStates.ZEnable, false );
device.SetRenderState( RenderStates.FillMode, (int)FillMode.Solid );
device.SetRenderState( RenderStates.ZBufferWriteEnable, false );
device.SetRenderState( RenderStates.FogEnable, false );
device.SetRenderState( RenderStates.AlphaTestEnable, false );
device.SetRenderState( RenderStates.AlphaBlendEnable, true );
device.SetRenderState( RenderStates.SourceBlend, (int)Blend.SourceAlpha );
device.SetRenderState( RenderStates.DestinationBlend, (int)Blend.InvSourceAlpha );
// Blend alphas
device.SetTextureState( 0, TextureStates.ColorArgument1, (int)TextureArgument.Texture );
device.SetTextureState( 0, TextureStates.AlphaArgument1, (int)TextureArgument.Texture );
device.SetTextureState( 0, TextureStates.AlphaArgument2, (int)TextureArgument.Diffuse );
device.SetTextureState( 0, TextureStates.AlphaOperation, (int)TextureOperation.Modulate );
// Set sampler states
device.SetSamplerState( 0, SamplerStates.MinFilter, (int)Filter.Linear );
device.SetSamplerState( 0, SamplerStates.MagFilter, (int)Filter.Linear );
device.SetSamplerState( 0, SamplerStates.MipFilter, (int)Filter.Linear );
Now, here's what I've figured out so far for XNA. This results in completely transparent quads (at least, I think they're completely transparent, as with this blending combo I don't see them at all):
Game.GraphicsDevice.RenderState.DepthBufferEnable = false;
Game.GraphicsDevice.RenderState.FillMode = FillMode.Solid;
Game.GraphicsDevice.RenderState.DepthBufferWriteEnable = false;
Game.GraphicsDevice.RenderState.FogEnable = false;
Game.GraphicsDevice.RenderState.AlphaTestEnable = false;
Game.GraphicsDevice.RenderState.AlphaBlendEnable = true;
Game.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
Game.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
In a variation on that, it results in visible quads, but not blended (completely opaque):
Game.GraphicsDevice.RenderState.DepthBufferEnable = false;
Game.GraphicsDevice.RenderState.FillMode = FillMode.Solid;
Game.GraphicsDevice.RenderState.DepthBufferWriteEnable = false;
Game.GraphicsDevice.RenderState.FogEnable = false;
Game.GraphicsDevice.RenderState.AlphaTestEnable = false;
Game.GraphicsDevice.RenderState.AlphaBlendEnable = true;
Game.GraphicsDevice.RenderState.SourceBlend = Blend.InverseSourceAlpha;
Game.GraphicsDevice.RenderState.DestinationBlend = Blend.SourceAlpha;
As you can see, I don't have any XNA code for the Sampler States or the Texture Alpha blending stuff from MDX. Any help will be appreciated.