示例#1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    // We're about to dispose, notify the application.
                    if (Disposing != null)
                    {
                        Disposing(this, EventArgs.Empty);
                    }

                    /* Dispose of all remaining graphics resources before
                     * disposing of the GraphicsDevice.
                     */
                    GraphicsResource.DisposeAll();

                    // Free all the cached shader programs.
                    programCache.Dispose();

                    // Dispose of the GL Device/Context
                    GLDevice.Dispose();
                }

                IsDisposed = true;
            }
        }