Take the 2-minute tour ×

A newbie to XNA here. This is a followup to my previous question that showed me part of what I was doing wrong but I'm still not getting what I want. I'm setting up a BasicEffect thus:

Effect = new BasicEffect(GraphicsDevice);
Effect.VertexColorEnabled = true;
Effect.Alpha = 1.0f;
Effect.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Effect.GraphicsDevice.BlendState = BlendState.Opaque;

and the draw loop:

GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, MaxDepth, 0);

All polygons are being rendered where and how I wish except they should be fully opaque and they aren't. The actual image looks more like the various colors are being combined in a fashion I'm not sure about:

alt text

share|improve this question
We could probably use a screenshot. –  Andrew Russell Dec 18 '10 at 2:08
add comment

1 Answer

up vote 3 down vote accepted

You must set the DepthStencilState and BlendState before drawing the object, and not when creating your Effect, just like this:

GraphicsDevice.DepthStencilState = DepthStencilState.Default;
GraphicsDevice.BlendState = BlendState.Opaque;

share|improve this answer
Thank you! I figured it was something simple I was not understanding. –  Loren Pechtel Dec 18 '10 at 18:13
add comment

Your Answer


