示例#1
0
        /// <summary>
        /// Creates a new VMR9 custom allocator to use with Direct3D
        /// </summary>
        public Vmr9Allocator()
        {
            /* Use the 9Ex for Vista */
            if (IsVistaOrBetter)
            {
                Direct3D.Direct3DCreate9Ex(D3D_SDK_VERSION, out m_d3dEx);
            }
            else /* For XP */
            {
                m_d3d = Direct3D.Direct3DCreate9(D3D_SDK_VERSION);
            }

            CreateDevice();
        }
示例#2
0
        static Vmr9Allocator()
        {
            m_hWnd = GetDesktopWindow();

            /* Use the 9Ex for Vista */
            if (IsVistaOrBetter)
            {
                Direct3D.Direct3DCreate9Ex(D3D_SDK_VERSION, out m_d3dEx);
            }
            else /* For XP */
            {
                m_d3d = Direct3D.Direct3DCreate9(D3D_SDK_VERSION);
            }

            CreateDevice();
        }
示例#3
0
        /// <summary>
        /// Creates a new VMR9 custom allocator to use with Direct3D
        /// </summary>
        public Vmr9Allocator()
        {
            /* Use the 9Ex for Vista */
            int hr = 0;

            if (IsVistaOrBetter)
            {
                hr = Direct3D.Direct3DCreate9Ex(D3D_SDK_VERSION, out m_d3dEx);
            }
            else /* For XP */
            {
                m_d3d = Direct3D.Direct3DCreate9(D3D_SDK_VERSION);
            }

            if (m_d3dEx == null && m_d3d == null)
            {
                string hrStr = hr == 0 ? "" : $"({hr:X})";
                throw new WPFMediaKitException($"Could not create IDirect3D9 {hrStr}. " + VMR9_ERROR);
            }

            CreateDevice();
        }