Search code examples
c#opentkvisual-studio-mac

OpenTK - GL. doesn't exist


Hi so I'm starting out with OpenTK and just following the tutorials on this website and I'm on this tutorial and it says to write the code:

protected override void OnLoad(EventArgs e)
{
    GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);

    base.OnLoad(e);
}

but when I try to write GL it doesn't come up in the instellisense and the output when I build it says: /directory/that/the/file/is/in/Game.cs(13,13): Error CS0103: The name 'GL' does not exist in the current context (CS0103) (OpenTKProject). I'm using all of the OpenTK namespaces but it doesn't work. I'm using Visual Studio for Mac version 8.7.4 (build 34) and MacOS 10.13.6 Heigh Sierra and I installed OpenTK and OpenTK.GLControl through NuGet with the warnings:

/Users/User/Projects/OpenGLProject/OpenGLProject/OpenGLProject.csproj: Warning NU1701: Package 'OpenTK 3.2.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project. (NU1701) (OpenGLTK)

and

/Users/User/Projects/OpenTKProject/OpenTKProject/OpenTKProject.csproj: Warning NU1701: Package 'OpenTK.GLControl 3.1.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project. (NU1701) (OpenGLTK)

Thanks in advance!


Solution

  • As far as I know there are still gaps in which packages are fully realized/supported in the dotnet5 (a.k.a. .NetCore) and I also don't fully understand where to locate the comparison cheatsheet etc. I think .NET 4.8 or whatever was the last LTS Windows-only distro of .NET and in future they appear to be focusing a lot of cross-platform availability so it might take a while.

    Other contributions by more seasoned .NET gurus may be able to shed some light on this.