Hi,
I am very new to XNA framework. I am writing a sample application in XNA for windows phone 7.
presently I am facing a problem.
In the sample, i am loading a Texture2D and dispose it in the next line and assign it to null. Again I load the same image to the same member variable. But in the draw I get ObjectDisposedException.
If I remove the dispose call it will not give any exception.
Please help me to solve this.
Sample:
Texture2D texture = null;
protected override void LoadContent()
{
texture = Content.Load<Texture2D>("Back");
texture .Dispose();
texture = null;
texture = Content.Load<Texture2D>("Back");
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(texture , new Vector2(0, 0), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}