Closed Cryru closed 5 years ago
This works for me:
static void Main(string[] args)
{
GLFWwindow mainWindow = Glfw.CreateWindow(800, 600, "Hello World", null, null);
if (mainWindow == null)
{
Glfw.Terminate();
return;
}
Gl.Initialize();
Glfw.MakeContextCurrent(mainWindow);
System.Console.WriteLine(Gl.CurrentVersion);
System.Console.WriteLine(Gl.CurrentShadingVersion);
while (Glfw.WindowShouldClose(mainWindow) <= 0)
{
Glfw.PollEvents();
Render();
Glfw.SwapBuffers(mainWindow);
}
Glfw.Terminate();
}
public static void Render()
{
Gl.Viewport(0, 0, 800, 600);
Gl.Clear(ClearBufferMask.ColorBufferBit);
Gl.MatrixMode(MatrixMode.Projection);
Gl.LoadIdentity();
Gl.Ortho(0.0, 1.0f, 0.0, 1.0, 0.0, 1.0);
Gl.MatrixMode(MatrixMode.Modelview);
Gl.LoadIdentity();
Gl.Begin(PrimitiveType.Triangles);
Gl.Color3(1.0f, 0.0f, 0.0f); Gl.Vertex2(0.0f, 0.0f);
Gl.Color3(0.0f, 1.0f, 0.0f); Gl.Vertex2(0.5f, 1.0f);
Gl.Color3(0.0f, 0.0f, 1.0f); Gl.Vertex2(1.0f, 0.0f);
Gl.End();
}
I'm trying to migrate to OpenGL.Net using GLFW3 with these bindings (https://github.com/realvictorprm/GLFW3.NET) and I'm getting a black window with no errors.
I'm having trouble understanding how to interface the contexts between the two libraries, and have so far written this: