private void OnUnload(object sender, EventArgs e) { base.OnUnload(); // Always make sure to properly dispose gl resources to prevent memory leaks. // Most of the examples do not explicitly dispose resources, because // the base class (ExampleWindow) calls GLResource.DisposeAll(this). // This will automatically dispose all objects referenced by class fields // which derive from GLResource. Everything else still has to be disposed manually. _program.Dispose(); mesh.Dispose(); }