Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other.

For example, at the start I have sprite font being drawn over a background image and half the text is not shown when I add the image.

        _sb.Draw(_background, new Rectangle(0, 0, 800, 480), Color.White);
        if (isPaused)
            _sb.DrawString(_bigFont, "Resume", new Vector2(295, 200), Color.Black);
        _sb.DrawString(_bigFont, "Start", new Vector2(315, 200), Color.Black);

The text then seems to appear if I change the value of other text on the screen.

Is there something I am missing here?


share|improve this question
How are you initializing the SpriteBatch? – John McDonald Feb 24 '12 at 23:35
spriteBatch = new SpriteBatch(GraphicsDevice); – boburob Feb 24 '12 at 23:38
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); – boburob Feb 24 '12 at 23:38
Can we have a picture? – ClassicThunder Feb 25 '12 at 0:03 When I update the something else on the screen the text appears. – boburob Feb 25 '12 at 0:16
up vote 2 down vote accepted

Unless you are actually playing with the Depth, you should be using SpriteSortMode.Deferred. MSDN Doc Here

If you are drawing everything at Depth 0, I'm pretty sure that XNA will pick a draw order for you. There are others discussing a similar issue here:

In 3D, this is usually called Z-fighting.

share|improve this answer
Perfect, thank you very much. – boburob Feb 25 '12 at 0:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.