1

I am a beginner to XNA and am experimenting with my new kinect for windows so decided to follow a tutorial: http://digitalerr0r.wordpress.com/2011/06/20/kinect-fundamentals-2-basic-programming/

After doing this one I noticed that all the colors are tinted light blue. For example a color of rgb 20,20,20 will look like dark blue instead of dark gray.

I noticed that the GraphicsDevice.Clear() is using Color.CornflowerBlue. I experimented with changing it to Color.Black and sure enough all the stuff are now tinted black.

What's the relationship between the GraphicsDevice.Clear(color) and the colors being drawn onto the screen?

Here's my draw function:

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);

    spriteBatch.Begin();
    spriteBatch.Draw(kinectRGBVideo, new Rectangle(0, 0, 640, 480), Color.White);
    spriteBatch.DrawString(font, connectedStatus, new Vector2(20, 80), Color.Black);
    spriteBatch.End();

    base.Draw(gameTime);
}
Razor Storm
  • 12,167
  • 20
  • 88
  • 148
  • Try changing the [BlendState](http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.blendstate_members.aspx) at the call of the [spriteBatch.Begin()](http://msdn.microsoft.com/en-us/library/ff433698.aspx) method. This dictates how colors blend when drawn above each other. – Chris Ortner Jul 31 '12 at 06:28
  • Nice! It worked wonderfully, change it to an answer and I'll accept it. Oh and by the way, do you know why using BlendState.Opaque will cause text to be displayed as blocks. – Razor Storm Jul 31 '12 at 06:48

1 Answers1

3

(As requested, in form of an answer.)

Try changing the BlendState at the call of the spriteBatch.Begin() method. This dictates how colors blend when drawn above each other.

I'm not exactly sure why BlendState.Opaque displays text as blocks, but my guess is that this blend state does not support alpha. Therefore the transparent regions around the text turn, well, opaque, making the text look like a rectangle. I don't have the tools to check this guess on me right now, so I can verify it.

Chris Ortner
  • 806
  • 6
  • 11