/// <summary> /// Initializes the Direct3D 9 device. /// </summary> private static void InitializeD3D9() { lock (_d3d9Lock) { _referenceCount++; if (_referenceCount == 1) { _d3D9 = new D3D9(); } } }
/// <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; } } }