Ejemplo n.º 1
0
 private void DestroyBuffers()
 {
     ImmediateContext.OutputMerger.SetRenderTargets((RenderTargetView)null);
     BackBufferView.Dispose();
     BackBuffer.Dispose();
     DepthBufferView.Dispose();
     DepthBuffer.Dispose();
 }
 public void DestroyBuffers()
 {
     if (BackBuffer != null)
     {
         ImmediateContext.OutputMerger.SetRenderTargets((RenderTargetView)null);
         BackBufferView.Dispose();
         BackBuffer.Dispose();
         DepthBufferView.Dispose();
         DepthBuffer.Dispose();
         BackBuffer = null;
     }
 }
        public void UnloadDirect3D()
        {
            if (!Ready)
            {
                return;
            }

            TextureCache.Dispose();

            DefaultTextureView.Dispose();
            DefaultTexture.Dispose();
            SampleState.Dispose();
            DefaultEffect.Dispose();
            BackBufferView.Dispose();
            BackBuffer.Dispose();
            DepthBufferView.Dispose();
            DepthBuffer.Dispose();
            Device.Dispose();
        }
Ejemplo n.º 4
0
        public void ExitAndRelease()
        {
            try
            {
                D2Ddevice.ImmediateContext.ClearState(); //设备即时上下文清理状态
                D2Ddevice.ImmediateContext.Flush();      //设备即时上下文刷新
                D2Ddevice.Dispose();                     //设备销毁
                D2Ddevice.Dispose();                     //设备销毁
                SwapChain.Dispose();                     //基础交换链销毁
                DXGIFactory.Dispose();                   //基础工厂销毁


                BackBufferView.Dispose();  //后备缓冲视图销毁
                BackBuffer.Dispose();      //后备缓冲销毁
            }
            catch (Exception)
            {
                return;
            }
        }