I’m using glfw-net, a NuGet package that lets me use glfw in c#
When I run glfw.Terminate()
this error is thrown.
This is the full code:
using GLFW;
using OpenGL;
namespace Starlight
{
class Program
{
private static List<Entity> ents = [];
static void Main(string[] args)
{
if (!Glfw.Init())
{
String msg;
throw new System.Exception($"GLFW STARTUP ERROR {Glfw.GetError(out msg)}: {msg}");
}
Glfw.WindowHint(Hint.ContextVersionMajor, 3);
Glfw.WindowHint(Hint.ContextVersionMinor, 3);
Glfw.WindowHint(Hint.OpenglProfile, Profile.Core);
var window = Glfw.CreateWindow(800, 600, "Starlight", GLFW.Monitor.None, Window.None);
if (window == Window.None)
{
String msg;
throw new System.Exception($"GLFW WINDOW CREATION ERROR {Glfw.GetError(out msg)}: {msg}");
}
Glfw.MakeContextCurrent(window);
Gl.Viewport(0, 0, 800, 600);
Glfw.SetFramebufferSizeCallback(window, WinManager.frameSizeChange);
while (!Glfw.WindowShouldClose(window))
{
Entity.MegaUpdate(ents);
Glfw.SwapBuffers(window);
Glfw.PollEvents();
}
try
{
Glfw.Terminate();
}
catch (GLFW.Exception e)
{
String msg;
Console.Error.WriteLine($"ERROR: {e.Message}, GLFW ERROR CODE: {Glfw.GetError(out msg)}: {msg}");
}
}
}
}