简体   繁体   English

如何在OS X上初始化QOpenGLContext以使用OpenGL版本3.3?

[英]How to initialize a QOpenGLContext on OS X to use OpenGL version 3.3?

I'm running OS X 10.9.4 and Qt 5.3.1. 我正在运行OS X 10.9.4和Qt 5.3.1。 I need to create a QOpenGLContext that uses Open GL 3.3. 我需要创建一个使用Open GL 3.3的QOpenGLContext。 My system reports 100% compatibility with OpenGL 3.3, however I am getting a context that supports 2.1 only. 我的系统报告与OpenGL 3.3的兼容性为100%,但是我得到的上下文仅支持2.1。 As well, calling versionFunctions() returns 0. 同样,调用versionFunctions()返回0。

What is the correct modification to, say, the OpenGL Window Example ( http://qt-project.org/doc/qt-5/qtgui-openglwindow-example.html ) that makes it possible to use OpenGL 3.3? 例如,对OpenGL窗口示例( http://qt-project.org/doc/qt-5/qtgui-openglwindow-example.html )的正确修改是什么,它可以使用OpenGL 3.3? I've tried to set the desired version on the QSurfaceFormat, but I haven't been able to make it work on this system (on Windows, I get a context with OpenGL version that matches the highest supported by that system — by default.) 我尝试在QSurfaceFormat上设置所需的版本,但是我无法使其在该系统上正常工作(在Windows上,默认情况下,我使用的OpenGL版本与该系统支持的最高版本相匹配。 )

我的问题得到了回答,问题是当我调用QSurfaceFormat :: setVersion(3,3)时,还需要先调用QSurfaceFormat :: setProfile(QSurfaceFormat :: CoreProfile),然后再将生成的QSurfaceFormat传递给setFormat。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM