如何在Qt 5.4中使用OpenGL 3.3核心配置文件?

时间:2015-06-30 06:09:16

标签: 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 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。

1 个答案:

答案 0 :(得分:2)

我在一个从QOpenGLWidget继承的小部件中这样做:

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