我如何在dotnetcore C#中为opentk创建openGL上下文

问题描述

我正在使用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,并且窗口创建处理了上下文创建。所以我不知道如何创建上下文。有人可以帮忙吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)