Exemplo n.º 1
0
        private static Directx2D.Direct3DDevice9Ex CreateDevice(IntPtr handle)
        {
            const int D3D_SDK_VERSION = 32;
            using (var d3d9 = Directx2D.Direct3D9Ex.Create(D3D_SDK_VERSION))
            {
                var present = new Directx2D.NativeStructs.D3DPRESENT_PARAMETERS();
                present.Windowed = 1; // TRUE
                present.SwapEffect = 1; // D3DSWAPEFFECT_DISCARD
                present.hDeviceWindow = handle;
                present.PresentationInterval = unchecked((int)0x80000000); // D3DPRESENT_INTERVAL_IMMEDIATE;

                return d3d9.CreateDeviceEx(
                    0, // D3DADAPTER_DEFAULT
                    1, // D3DDEVTYPE_HAL
                    handle,
                    70, // D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE
                    present,
                    null);
            }
        }
Exemplo n.º 2
0
        private static Directx2D.Direct3DDevice9Ex CreateDevice(IntPtr handle)
        {
            const int D3D_SDK_VERSION = 32;

            using (var d3d9 = Directx2D.Direct3D9Ex.Create(D3D_SDK_VERSION))
            {
                var present = new Directx2D.NativeStructs.D3DPRESENT_PARAMETERS();
                present.Windowed             = 1;                           // TRUE
                present.SwapEffect           = 1;                           // D3DSWAPEFFECT_DISCARD
                present.hDeviceWindow        = handle;
                present.PresentationInterval = unchecked ((int)0x80000000); // D3DPRESENT_INTERVAL_IMMEDIATE;

                return(d3d9.CreateDeviceEx(
                           0,  // D3DADAPTER_DEFAULT
                           1,  // D3DDEVTYPE_HAL
                           handle,
                           70, // D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE
                           present,
                           null));
            }
        }