Пример #1
0
 /// <summary>
 /// Creates an <see cref="SharpDX.Direct3D9.Direct3DEx"/> object and returns an interface to it.
 /// </summary>
 /// <remarks>
 /// The <see cref="SharpDX.Direct3D9.Direct3DEx"/> object is the first object that the application creates and the last object that the application releases. Functions for enumerating and retrieving capabilities of a device are accessible through the IDirect3D9Ex object. This enables applications to select devices without creating them.   The <see cref="SharpDX.Direct3D9.Direct3DEx"/> interface supports enumeration of active display adapters and allows the creation of IDirect3D9Ex objects. If the user dynamically adds adapters (either by adding devices to the desktop, or by hot-docking a laptop), these devices are not included in the enumeration. Creating a new IDirect3D9Ex interface will expose the new devices.   Pass the D3D_SDK_VERSION flag to this function to ensure that header files used in the compiled application match the version of the installed runtime DLLs. D3D_SDK_VERSION is changed in the runtime only when a header or another code change would require rebuilding the application. If this function fails, it indicates that the versions of the header file and the runtime DLL do not match.  Note??Direct3DCreate9Ex is supported only in Windows Vista, Windows Server 2008, and Windows 7.   Earlier versions of the D3D9.dll library do not include Direct3D9Ex and Direct3DCreate9Ex.
 /// </remarks>
 /// <returns>D3DERR_NOTAVAILABLE if Direct3DEx features are not supported (no WDDM driver is installed) or if the SDKVersion does not match the version of the DLL.   D3DERR_OUTOFMEMORY if out-of-memory conditions are detected when creating the enumerator object.  S_OK if the creation of the enumerator object is successful.  </returns>
 /// <unmanaged>HRESULT Direct3DCreate9Ex([None] int SDKVersion,[None] IDirect3D9Ex** arg1)</unmanaged>
 public Direct3DEx() : base(IntPtr.Zero)
 {
     D3D9.Create9Ex(D3D9.SdkVersion, this);
     Adapters   = new AdapterCollection(this);
     AdaptersEx = new AdapterExCollection(this);
 }
Пример #2
0
 /// <summary>
 /// Initializes the Direct3D 9 device.
 /// </summary>
 private static void InitializeD3D9()
 {
     lock (_d3d9Lock)
     {
         _referenceCount++;
         if (_referenceCount == 1)
             _d3D9 = new D3D9();
     }
 }
Пример #3
0
 /// <summary>
 /// Un-initializes the Direct3D 9 device, if no longer needed.
 /// </summary>
 private static void UninitializeD3D9()
 {
     lock (_d3d9Lock)
     {
         _referenceCount--;
         if (_referenceCount == 0)
         {
             _d3D9.Dispose();
             _d3D9 = null;
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Create an IDirect3D9 object and return an interface to it.
 /// </summary>
 /// <remarks>
 ///  The Direct3D object is the first Direct3D COM object that your graphical application needs to create and the last object that your application needs to release. Functions for enumerating and retrieving capabilities of a device are accessible through the Direct3D object. This enables applications to select devices without creating them. Create an IDirect3D9 object as shown here:
 /// <code> LPDIRECT3D9 g_pD3D = NULL; if( NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION))) return E_FAIL; </code>
 ///
 ///  The IDirect3D9 interface supports enumeration of active display adapters and allows the creation of <see cref="SharpDX.Direct3D9.Device"/> objects. If the user dynamically adds adapters (either by adding devices to the desktop, or by hot-docking a laptop), those devices will not be included in the enumeration. Creating a new IDirect3D9 interface will expose the new devices. D3D_SDK_VERSION is passed to this function to ensure that the header files against which an application is compiled match the version of the runtime DLL's that are installed on the machine. D3D_SDK_VERSION is only changed in the runtime when a header change (or other code change) would require an application to be rebuilt. If this function fails, it indicates that the header file version does not match the runtime DLL version. For an example, see {{Creating a Device (Direct3D 9)}}.
 /// </remarks>
 public Direct3D()
 {
     FromTemp(D3D9.Create9(D3D9.SdkVersion));
     Adapters = new AdapterCollection(this);
 }