【发布时间】:2020-10-06 08:03:47
【问题描述】:
我正在使用 opentk 在 C# .Net Core 中编写我的图形控制台应用程序。我继承了GameWindow 类:
class OpenGLWindow:GameWindow
{
public OpenGLWindow(GameWindowSettings gws, NativeWindowSettings nws):base(gws, nws)
{
}
//other overloaded methods here
}
我在 main 方法中创建了这样的窗口:
Console.WriteLine("Hello World!");
NativeWindowSettings settings = NativeWindowSettings.Default;
settings.Title = "Befiker";
settings.APIVersion = new Version(4, 6);
GameWindowSettings gws = new GameWindowSettings();
gws.RenderFrequency = 60.0;
using(var win = new OpenGLWindow(gws, settings))
{
win.Run();
}
Console.ReadKey();
窗口已创建,但我注意到它没有清除缓冲区位。我确定这是因为我还没有创建 opengl 上下文。 NativeWindowSettings 类采用 SharedContext 类型的 IGLFWGraphics 上下文。这就是我卡住的地方。我在 c++ 上使用了 glfw 和 opengl 4.6,窗口创建处理上下文创建。所以我不知道如何创建上下文。有人可以帮忙吗?
【问题讨论】:
标签: c# .net-core glfw opentk opengl-4