Sign in to follow this  

XNA - alpha blend not working but alpha test does

Recommended Posts

Just started on a little project, all I want for now is to draw a textured quad on top of what ever is on screen. When I use alpha blending nothing happens, I get every part of my texture visible. When I use alpha test then everything looks correct. This is all pretty simple I know so I must be over looking somehting very basic, any ideas what? My render method:
public void Render(GraphicsDevice graphicsDevice)
            graphicsDevice.VertexDeclaration = m_VertexDecl;
            /*graphicsDevice.RenderState.AlphaTestEnable = true;
            graphicsDevice.RenderState.AlphaFunction = CompareFunction.GreaterEqual;
            graphicsDevice.RenderState.ReferenceAlpha = 127;*/
            graphicsDevice.RenderState.AlphaBlendEnable = true;
            graphicsDevice.RenderState.AlphaSourceBlend = Blend.SourceAlpha;
            graphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha;

            m_Effect.View = ViewMatrix;
            m_Effect.Projection = ProjectionMatrix;

            foreach (EffectPass pass in m_Effect.CurrentTechnique.Passes)

                    vertices, 0, 4,
                    indices, 0, 2);

The only other thing going on is clearing the color just before calling this method. The effect is just BasicEffect. Thanks.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this