/// <summary> /// Dispose pattern implementation of dispose method. /// </summary> /// <param name="disposing">True if disposing, false if finalizing.</param> protected virtual void Dispose(bool disposing) { if (Disposed) { return; } if (TextureSwapChainPtr != IntPtr.Zero) { OVR.DestroyTextureSwapChain(Session, TextureSwapChainPtr); TextureSwapChainPtr = IntPtr.Zero; // Notify subscribers that this object has been disposed. if (ObjectDisposed != null) { ObjectDisposed(this); } } GC.SuppressFinalize(this); Disposed = true; }