class MyGame : Game
{
[STAThread]
static void Main(string[] args)
{
using (MyGame g = new MyGame())
{
g.Run();
}
}
private readonly GraphicsDeviceManager gdm;
MyGame()
{
gdm = new GraphicsDeviceManager(this);
Window.AllowUserResizing = true;
}
bool flag = true;
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if (flag)
{
flag = false;
GraphicsDevice gd = GraphicsDevice;
RenderTarget2D renderTarget = new RenderTarget2D(gd, 10, 10);
gd.SetRenderTarget(renderTarget);
renderTarget.Dispose();
gd.SetRenderTarget(null);
}
}
}
When use XNA, it no error.
When use FNA, it throw error System.InvalidOperationException: Disposing target that is still bound.
How to the same behavior to them?
Note: if remove gd.SetRenderTarget(null);, XNA will throw error.
When use XNA, it no error.
When use FNA, it throw error
System.InvalidOperationException: Disposing target that is still bound.How to the same behavior to them?
Note: if remove
gd.SetRenderTarget(null);, XNA will throw error.