Newer QOpenGLWidget doesn't support any constructor with QGLFormat. Instead, in your main.cpp, specify the default QSurfaceFormat for all QOpenGLWidget and QOpenGLContext as following:// main.cppQSurfaceFormat glFormat;glFormat.setVersion(3, 3);glFormat.setProfile(QSurfaceFormat::CoreProfile);QSurfaceFormat::setDefaultFormat(glFormat);现在你应该可以在你的着色器中使用类似 #version 330 core 的东西了.Now you should be able to use something like #version 330 core in your shader. 这篇关于Qt5 OpenGL GLSL 版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-13 05:44