Esempio n. 1
0
        public override void ToggleFullScreen(IntPtr handle)
        {
            //if (LostDevice != null)
            //    LostDevice();

            factory.SetWindowAssociation(handle, SlimDX.DXGI.WindowAssociationFlags.IgnoreAll);


            SwapChain.Dispose();
            backBuffer.Dispose();
            RenderView.Dispose();

            SwapChain = new SlimDX.DXGI.SwapChain(factory, Device10, new SlimDX.DXGI.SwapChainDescription
            {
                BufferCount       = 1,
                ModeDescription   = new SlimDX.DXGI.ModeDescription(View.ClientSize.Width, View.ClientSize.Height, new Rational(60, 1), SlimDX.DXGI.Format.R8G8B8A8_UNorm),
                IsWindowed        = false,
                OutputHandle      = handle,
                SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
                SwapEffect        = SlimDX.DXGI.SwapEffect.Discard,
                Usage             = SlimDX.DXGI.Usage.RenderTargetOutput,
                Flags             = SlimDX.DXGI.SwapChainFlags.AllowModeSwitch
            });
            backBuffer = SlimDX.Direct3D10.Texture2D.FromSwapChain <SlimDX.Direct3D10.Texture2D>(SwapChain, 0);
            RenderView = new SlimDX.Direct3D10.RenderTargetView(Device10, backBuffer);

            //Create(handle);

            //SwapChain.SetFullScreenState(true, null);

            //if (ResetDevice != null)
            //    ResetDevice();
        }
Esempio n. 2
0
 public override void Destroy()
 {
     Device10.Dispose();
     SwapChain.Dispose();
     backBuffer.Dispose();
     RenderView.Dispose();
     DepthStencilView.Dispose();
     depthStencil.Dispose();
     depthStencilState.Dispose();
 }
Esempio n. 3
0
 public void Dispose()
 {
     VertexBuffer.Dispose();
     RenderView.Dispose();
     Device.ImmediateContext.ClearState();
     Device.ImmediateContext.Flush();
     Device.ImmediateContext.Dispose();
     Device.Dispose();
     SwapChain.Dispose();
     VertexShader.Dispose();
     PixelShader.Dispose();
     InputLayout.Dispose();
     BackBuffer.Dispose();
     Factory.Dispose();
 }
Esempio n. 4
0
 protected override void Dispose(bool isDisposing)
 {
     if (ResourceView != null && !ResourceView.IsDisposed)
     {
         ResourceView.Dispose();
     }
     if (RenderView != null && !RenderView.IsDisposed)
     {
         RenderView.Dispose();
     }
     if (Texture != null && !Texture.IsDisposed)
     {
         Texture.Dispose();
     }
 }
Esempio n. 5
0
        protected override void WindowResize(int width, int height)
        {
            base.WindowResize(width, height);


            Device.ImmediateContext.ClearState();

            _renderTarget2D.Dispose();
            BackBuffer.Dispose();
            RenderView.Dispose();
            _surface?.Dispose();

            SwapChain.ResizeBuffers(1, 0, 0, Format.R8G8B8A8_UNorm, SwapChainFlags.None);

            BackBuffer      = Resource.FromSwapChain <Texture2D>(SwapChain, 0);
            RenderView      = new RenderTargetView(Device, BackBuffer);
            _surface        = BackBuffer.QueryInterface <Surface>();
            _renderTarget2D = new RenderTarget(Factory2D, _surface,
                                               new RenderTargetProperties(new PixelFormat(Format.R8G8B8A8_UNorm, AlphaMode.Premultiplied)));
        }