问题标签 [nsopenglview]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
macos - NSOpenGLView 在 macOS 10.9 上放弃了它的 NSOpenGLContext
该类NSOpenGLView
有一个读/写属性openGLContext
,当我阅读文档时,getter 永远不应该返回 nil:
如果接收者没有关联的上下文对象,
NSOpenGLContext
则创建一个新对象。使用接收器的像素格式信息初始化新对象。
在 macOS 10.13 上,这似乎是真的,但在 macOS 10.9 上,在我将视图添加到窗口后它返回 nil。也就是说,如果我这样做:
然后在第二个日志上,上下文为零。有什么解决办法吗?自己制作NSOpenGLContext
并分配它没有帮助。我已经验证主机视图是窗口的一部分并且windowNumber
是肯定的。