protected virtual void Dispose(bool disposing) { if (!isDisposed) { dev.WaitIdle(); for (int i = 0; i < swapChain.ImageCount; i++) { dev.DestroySemaphore(drawComplete[i]); cmds[i].Free(); } swapChain.Dispose(); vkDestroySurfaceKHR(instance.Handle, hSurf, IntPtr.Zero); cmdPool.Dispose(); if (disposing) { dev.Dispose(); instance.Dispose(); } else { Debug.WriteLine("a VkWindow has not been correctly disposed"); } Glfw3.DestroyWindow(hWin); Glfw3.Terminate(); isDisposed = true; } }
static void Main() { Glfw3.Init(); Console.WriteLine($"GLFW3 version: {Glfw3.GetVersion ()}"); IntPtr win = Glfw3.CreateWindow(100, 100, "test", MonitorHandle.Zero, IntPtr.Zero); Glfw3.DestroyWindow(win); Glfw3.Terminate(); }
private unsafe void Run() { var extensions = Instance.EnumerateExtensionProperties(null); var instance = Instance.Create(null, Glfw3.GetRequiredInstanceExtensions()); var device = instance.EnumeratePhysicalDevices().First().CreateDevice(new DeviceQueueCreateInfo { QueueFamilyIndex = 0, QueuePriorities = new[] { 0f } }, null, null); device.GetQueue(0, 0); try { Glfw3.Init(); using (var window = new Window(1920, 1080, "Test")) { SetCallbacks(window); while (!window.ShouldClose) { Glfw3.PollEvents(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } finally { Glfw3.Terminate(); } }