Hi, I am developing a cross-platform graphics application, which uses OpenTK. On Windows, I can reference OpenTK and OpenTK.GLControl dlls to initialize my rendering context like this, and in particular, request a modern OpenGL graphics context (in this case, OpenGL 3.3):
int major = 3;
int minor = 3;
var control = new OpenTK.GLControl(GraphicsMode.Default, major, minor, GraphicsContextFlags.Default);
I have studied your examples (Introduction to OpenTK and MonoMacGameView) and they demonstrate using OpenTK like this:
Game = new MonoMacGameView (ContentView.Frame);
ContentView = Game;
Game.Run();
However, when I do this, and then check the OpenGL version like this:
string version = GL.GetString(StringName.Version); // "2.1 INTEL-10.14.66"
string glsl = GL.GetString(StringName.ShadingLanguageVersion); // "1.20"
...I get what appears to be an obsolete context, and furthermore, I can't seem to specify that I want anything else. My system (OS X 10.11.5, Mac mini (Late 2014) Intel Iris) should be able to support OpenGL 4.1, according to this: https://support.apple.com/en-us/HT202823
Furthermore, your examples use Immediate Mode (e.g. GL.Begin
), which has long since been removed from the OpenGL core profile specification. So, my questions are:
Is it possible to obtain a modern OpenGL context in OpenTK on Mac? If so, how?
Is there an equivalent of OpenTK.GLControl for Mac other than MonoMacGameView, or is that the correct (and only) option?
When setting up my solution in Xamarin, I have a Portable Class Library, and then separate projects (one for Mac and one for Windows) that reference it. The Windows project references OpenTK dlls; and the Mac project references OpenTK via NuGet as described in your tutorial. Is that the intended way to structure my solution?
Any help is greatly appreciated. Thanks.