I have a textured model displayed in my virtual world. The problem I’m having is when I draw text on the screen, the model becomes darker and partially transparent on the visible side. here is the function Im calling:
private void DrawText()
{
spriteBatch.Begin();
spriteBatch.DrawString(debugFont, "X: " + modelPosition.X + " Y: " + modelPosition.Y
+ " Z: " + modelPosition.Z, new Vector2(150, 150), Color.White);
spriteBatch.End();
}
Any suggestions as to how to get the model to correctly render while text is on the screen?
Using SpriteBatch has side effects on alpha and other properties of the render state. You can restore the defaults after your text work, which should get rid of the issue. See this article for more info:
http://www.riemers.net/Forum/index.php?var=1594&var2=0
Shawn Hargreaves has more information on the exact properties which are affected:
http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx