问题描述
我正在尝试设置一些非常简单的图形窗口,不幸的是,我也必须在 MacOS 版本的 Big Sur 上使用这些窗口。我正在使用 F# 编程语言和 OpenTK 包。
这是我目前拥有的代码。
open OpenTK.Windowing.Desktop
open OpenTK.Mathematics
open OpenTK.Windowing.Common
open OpenTK.Graphics
[<EntryPoint>]
let main argv =
let prof = ContextProfile.Compatability
let windowSettings = NativeWindowSettings()
windowSettings.Size <- Vector2i(800,600)
windowSettings.Title <- "OpenTK Window"
windowSettings.Profile <- prof
windowSettings.APIVersion <- Version "3.3"
use window = new GameWindow(GameWindowSettings.Default,windowSettings)
//window.MakeCurrent()
//window.Run ()
0
每当我运行这个时,我得到:
Unhandled exception. OpenTK.Windowing.GraphicslibraryFramework.GLFWException: NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above
at OpenTK.Windowing.Desktop.GLFWProvider.<>c.<.cctor>b__5_0(ErrorCode errorCode,String description)
我已经尝试了所有可能的配置,但我很困惑,有没有人可以指导我如何为此设置兼容性?
解决方法
改变这个
let prof = ContextProfile.Compatability
到
let prof = ContextProfile.Core