简体   繁体   中英

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. I need to create a QOpenGLContext that uses Open GL 3.3. My system reports 100% compatibility with OpenGL 3.3, however I am getting a context that supports 2.1 only. As well, calling versionFunctions() returns 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? 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 :: setVersion(3,3)时,还需要先调用QSurfaceFormat :: setProfile(QSurfaceFormat :: CoreProfile),然后再将生成的QSurfaceFormat传递给setFormat。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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