I am working on a game which consists of 3D elements and a 2D GUI. I have it working properly, but I want to enable multisampling for only the 3D parts, and not the 2D Textures. Otherwise, the GUI icons become blurred.
Here is the code for my Draw method
protected override void Draw(GameTime gameTime)
{
graphics.PreferMultiSampling = true;
graphics.ApplyChanges();
GraphicsDevice.Clear(Color.Black);
GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
foreach (Element e in Elements)// 3D part
{
e.Draw(GraphicsDevice, camera);
}
graphics.PreferMultiSampling = false;
graphics.ApplyChanges();
spriteBatch.Begin();
UIM.Draw(GraphicsDevice, spriteBatch);
spriteBatch.End();//
base.Draw(gameTime);
}
Using this code, I get an exception because all of my Texture2Ds dispose for some reason.
Is there a way to change the MultiSampling in the middle of the Draw method?