Пример #1
0
        private void ConfigureRenderTarget()
        {
            try
            {
                // if the device has had a chance to be init
                if (dm != null && dm.Device != null)
                {
                    PresentParameters presentParams = dm.PresentParameters;

                    presentParams.DeviceWindow = this;

                    presentParams.BackBufferHeight = this.ClientSize.Height;
                    presentParams.BackBufferWidth  = this.ClientSize.Width;

                    swapChain = new SwapChain(dm.Device, presentParams);

                    depthStencil = dm.Device.CreateDepthStencilSurface(this.ClientSize.Width, this.ClientSize.Height,
                                                                       presentParams.AutoDepthStencilFormat, presentParams.MultiSample, presentParams.MultiSampleQuality,
                                                                       true);

                    // setup arcball
                    arcBall.SetWindow(swapChain.PresentParamters.BackBufferWidth, swapChain.PresentParamters.BackBufferHeight, 0.85f);
                }
            }
            catch
            {
                ConfigureRenderTarget();
            }
        }