如何在Qt5.4中使用OpenGL 3.3核心配置文件?

如何在Qt5.4中使用OpenGL 3.3核心配置文件?,qt,opengl,glsl,Qt,Opengl,Glsl,我从glxinfo | grep OpenGL获得以下输出: OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.7.0-devel (git-e566e52 2015-06-29 vivi

我从
glxinfo | grep OpenGL
获得以下输出:

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.7.0-devel (git-e566e52 2015-06-29 vivid-oibaf-ppa)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.7.0-devel (git-e566e52 2015-06-29 vivid-oibaf-ppa)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 10.7.0-devel (git-e566e52 2015-06-29 vivid-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
以及我的CG类Qt 5.4应用程序中的以下内容:

OpenGL Version: 3.0 Mesa 10.7.0-devel (git-e566e52 2015-06-29 vivid-oibaf-ppa)
GLSL Version: 1.30

那么如何使用OpenGL的核心配置文件呢?我真的需要GLSL 3.3。

我在一个从QOpenGLWidget继承而来的小部件中实现它,如下所示:

QSurfaceFormat fmt;
fmt.setVersion( 3, 3 );
fmt.setProfile( QSurfaceFormat::CoreProfile );
setFormat( fmt );
QSurfaceFormat::setDefaultFormat( fmt );