void RenderFrame_Resize(object sender, EventArgs e)
        {
            commandQueue.Add(
                () => {
                device.ClearState();
                foreach (var view in views)
                {
                    view.Dispose();
                }

                swapChain.ResizeBuffers(BackBufferCount, renderFrame.ClientSize.Width >> 1 << 1,
                                        renderFrame.ClientSize.Height >> 1 << 1, BackBufferFormat, SwapChainFlags.None);

                SetDefaultRenderingBuffer();
                SetDefaultViewport();

                InitBlending();
            });
        }
Exemple #2
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!base.IsDisposed)
            {
                if (disposing)
                {
                    //Clear references
                    Array.Clear(_currentVertexBuffers, 0, _currentVertexBufferCount);
                    Array.Clear(_vertexBindings, 0, _currentVertexBufferCount);
                    _renderTargetManager.ClearAll();

                    _tracker.ReleaseAllResources();
                    _graphicsDevice.ClearState();
                    _graphicsDevice.Dispose();
                    _factory.Dispose();
                }
                base.Dispose(disposing);
#if DEBUG
                System.Diagnostics.Debug.Write(SlimDX.ObjectTable.ReportLeaks());
#endif
            }
        }