private static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Initialize(); GorgonApplication.Run(_mainForm, Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { GorgonExample.UnloadResources(); // Always clean up when you're done. // Since Gorgon uses Direct 3D 11.4, we must be careful to dispose of any objects that implement IDisposable. // Failure to do so can lead to warnings from the Direct 3D runtime when running in DEBUG mode. _depthStencil?.Dispose(); _texture?.Dispose(); _geometryShader?.Dispose(); _pixelShader?.Dispose(); _vertexShader?.Dispose(); _bufferless?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // Now begin running the application idle loop. GorgonApplication.Run(Initialize(), Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { // Always clean up when you're done. // Since Gorgon uses Direct 3D 11.1, which allocate objects that use native memory and COM objects, we must be careful to dispose of any objects that implement // IDisposable. Failure to do so can lead to warnings from the Direct 3D runtime when running in DEBUG mode. GorgonExample.UnloadResources(); _texture?.Dispose(); _constantBuffer?.Dispose(); _vertexBuffer.VertexBuffer?.Dispose(); _inputLayout?.Dispose(); _vertexShader?.Dispose(); _pixelShader?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.FormClosing" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.FormClosingEventArgs" /> that contains the event data.</param> protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); GorgonExample.UnloadResources(); _pluginCache?.Dispose(); _texture?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); _image?.Dispose(); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Initialize(); GorgonApplication.Run(_mainForm, Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { GorgonExample.UnloadResources(); _2D.Dispose(); // Always call dispose so we can free the native memory allocated for the backing graphics API. _sphere?.Dispose(); if (_planes != null) { foreach (Plane plane in _planes) { plane?.Dispose(); } } _texture?.Dispose(); _wvpBuffer?.Dispose(); _materialBuffer?.Dispose(); _vertexShader?.Dispose(); _pixelShader?.Dispose(); _inputLayout?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }