在 Python 中创建向前兼容的 OpenGL 3.x 上下文
我正在使用 wxPython,并且想使用基于 OpenGL 的画布,但我不希望上下文支持已弃用的功能。我已经在 Eclipse 中浏览了 pyopengl 和 pyglet,但看起来他们不支持这一点。我这样说是因为我找不到用于将属性分配给上下文的 WGL 函数,如 AMD 白皮书。在为上下文指定配置时,pylget 的文档中也没有提及兼容性状态参数。我是否忽略了什么?是否有“Python”解决方案,或者我需要开始寻找像 ctypes 这样的东西?
编辑:阅读更多文档后,看起来有一个 OpenGL
pyopengl 模块,名为 FORWARD_COMPATIBLE_ONLY
,将从 OpenGL.GL
中过滤已弃用的入口点,但仅从此模块中过滤。 pyopengl 网站上的 OpenGL 3.x Deprecations 部分甚至提到了这一点我以前没有注意到。如果这意味着 GLSL 弃用也将受到防范,那么这看起来像是一个解决方案。
I am using wxPython and I want to use an OpenGL based canvas, but I don't want the context to support deprecated functionality. I've navigated through pyopengl and pyglet in Eclipse, but it did not look like they support this. I'm saying this because I could not find WGL functions used in assigning attributes to a context, as in this white paper by AMD. There was also no mention in pylget's documentation of a compatibility status parameter when specifying a config for a context. Am I overlooking something? Is there a 'Python' solution or would I need to start looking at something like ctypes?
Edit: After reading some more documentation, it looks like there is a flag for the OpenGL
pyopengl module, called FORWARD_COMPATIBLE_ONLY
, that will filter deprecated entry points from OpenGL.GL
, but only from this module. There is even mention of this on the pyopengl site under the OpenGL 3.x Deprecations section that I had not noticed before. If this implies GLSL deprecations will also be guarded against, then this looks like a solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不能断然地说没有办法做到这一点,但我可以指出,鉴于对 OpenGL 最近修订版的大部分负面反应,我怀疑开发人员是否会急于将此类内容合并到他们的库中。
例如,pyglet 的核心渲染功能主要依赖于旧的预着色器系统,因此它没有理由提供一种方法来弃用所有旧功能。
我希望如果你想在早期阶段做到这一点,你就必须自己做。
I can't categorically say that there's no way of doing this but I can point out that given the largely negative response to recent revisions of OpenGL that I doubt there will be a rush for developers to incorporate this sort of thing into their libraries.
For example, pyglet's core rendering functionality mainly relies on the old pre-shader system so there is really little reason for it to provide a way to deprecate all the older functions.
I expect that if you want this at this early stage, you'll have to do it yourself.