微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MacOs OpenGl 向前兼容性?

如何解决MacOs OpenGl 向前兼容性?

我正在尝试设置一些非常简单的图形窗口,不幸的是,我也必须在 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。