Example #1
0
        public DefaultDevice(DefaultEye eye, CAdapter adapter, DeviceInitializationFlags flags,
            WindowHandle windowHandle, ref SwapChainDescription implicitSwapChainDescription,
            IFileSystem fileSystem)
        {
            this.eye = eye;
            this.adapter = adapter;
            this.flags = flags;

            primaryWindow = new DefaultWindow(this, windowHandle.ClientWidth, windowHandle.ClientHeight,
                ref implicitSwapChainDescription, windowHandle.Title, GameWindowFlags.Default,
                ((COutput)adapter.Outputs[0]).GLDisplayDevice, ref glContext);

            creator = new CDeviceChildCreator(this);
            immediateContext = new CDeviceContext(this, glContext);
        }
Example #2
0
        public WinformsDevice(Factory1 dxgiFactory, WinformsEye eye, CAdapter adapter,
            ControlWindow primaryWindow, SwapChainDescription primarySwapChainDesc,
            DeviceInitializationFlags flags, IFileSystem fileSystem)
        {
            this.flags = flags;
            this.eye = eye;
            this.dxgiFactory = dxgiFactory;
            this.adapter = adapter;

            d3dDevice = new Device(adapter.DXGIAdapter, CtSharpDX11.DeviceCreationFlags(flags));

            primarySwapChain = new CSwapChain(this, primaryWindow, ref primarySwapChainDesc,
                pswc => { }, () => !primaryWindow.IsVisible && additionalSwapChains.All(aswc => !aswc.Window.IsVisible));

            creator = new CDeviceChildCreator(this);
            immediateContext = new CDeviceContext(this, d3dDevice.ImmediateContext);

            additionalSwapChains = new List<CSwapChain>();
        }
Example #3
0
        public WinformsDevice(WinformsEye eye, Direct3D direct3D, CAdapter adapter, 
            ControlWindow primaryWindow, SwapChainDescription implicitSwapChainDesc, 
            DeviceInitializationFlags flags, IFileSystem fileSystem)
        {
            this.eye = eye;
            this.adapter = adapter;
            this.primaryWindow = primaryWindow;
            this.implicitSwapChainDesc = implicitSwapChainDesc;
            this.flags = flags;

            caps = adapter.Info.GetCaps(DeviceType.Hardware);
            devicePresentParams = new PresentParameters();

            FillDevicePresentParams();
            d3dDevice = new Device(direct3D, adapter.Index, DeviceType.Hardware, primaryWindow.Handle, CreateFlags.FpuPreserve | CreateFlags.HardwareVertexProcessing, devicePresentParams);

            CreateBackBufferAndDepthStencil();

            additionalSwapChains = new List<CAdditionalSwapChain>();
            creator = new CDeviceChildCreator(this);
            immediateContext = new CDeviceContext(this);

            lastSwapChainSize = new IntSize(primaryWindow.SwapChainWidth, primaryWindow.SwapChainHeight);
            fullscreenState = FullscreenState.Windowed;
            fullscreenDisplayMode = adapter.GetSupportedDisplayModes().First();
        }