示例#1
0
        /// <summary>
        ///
        /// </summary>
        private void StartD3D()
        {
#if DX11
            var adapter = GetBestAdapter();
            if (adapter == null)
            {
                System.Windows.MessageBox.Show("No DirectX 10 or higher adapter found, a software adapter will be used!", "Warning");
                this.device = new Direct3D11.Device(DriverType.Warp, DeviceCreationFlags.BgraSupport, FeatureLevel.Level_11_0);
            }
            else
            {
                this.device = new Direct3D11.Device(adapter, DeviceCreationFlags.BgraSupport);
                //this.device = new Direct3D11.Device(Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, Direct3D.FeatureLevel.Level_11_0);
            }
#else
            this.device = new Direct3D11.Device(Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, Direct3D.FeatureLevel.Level_10_1);
#endif
            this.surfaceD3D = new DX11ImageSource();
            this.surfaceD3D.IsFrontBufferAvailableChanged += this.OnIsFrontBufferAvailableChanged;
            this.effects = EffectsManager.Instance;
            this.effects.InitEffects(this.device);
            this.deferredRenderer = new DeferredRenderer();

            this.CreateAndBindTargets();
            this.SetDefaultRenderTargets();
            this.Source = this.surfaceD3D;
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        private void StartD3D()
        {
#if DX11
            var adapter = GetBestAdapter();
            if (adapter == null)
            {                
                System.Windows.MessageBox.Show("No DirectX 10 or higher adapter found, a software adapter will be used!", "Warning");
                this.device = new Direct3D11.Device(DriverType.Warp, DeviceCreationFlags.BgraSupport, FeatureLevel.Level_11_0);
            }
            else
            {
                this.device = new Direct3D11.Device( adapter, DeviceCreationFlags.BgraSupport);
                //this.device = new Direct3D11.Device(Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, Direct3D.FeatureLevel.Level_11_0); 
            }       
#else
            this.device = new Direct3D11.Device(Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, Direct3D.FeatureLevel.Level_10_1);                        
#endif            
            this.surfaceD3D = new DX11ImageSource();
            this.surfaceD3D.IsFrontBufferAvailableChanged += this.OnIsFrontBufferAvailableChanged;
            this.effects = EffectsManager.Instance;
            this.effects.InitEffects(this.device);
            this.deferredRenderer = new DeferredRenderer();
            
            this.CreateAndBindTargets();
            this.SetDefaultRenderTargets();
            this.Source = this.surfaceD3D;
        }