public void OnDestroyed() { // Destroy presenter first (so that its backbuffer and render target are destroyed properly before other resources) GraphicsDevice.Presenter.OnDestroyed(); foreach (var resource in GraphicsDevice.Resources) { resource.OnDestroyed(); resource.LifetimeState = GraphicsResourceLifetimeState.Destroyed; } // Clear various graphics device internal states (input layouts, FBOs, etc...) GraphicsDevice.OnDestroyed(); }