Qt5 OpenGL GLSL version error

前端 未结 3 1259
渐次进展
渐次进展 2020-12-10 20:13

I\'m starting out on using OpenGL with Qt, and with Shaders (I have OpenGL experience, but not with shaders yet)

I\'m following this tutorial: http://releases.qt-pro

3条回答
  •  没有蜡笔的小新
    2020-12-10 20:57

    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.cpp
    QSurfaceFormat glFormat;
    glFormat.setVersion(3, 3);
    glFormat.setProfile(QSurfaceFormat::CoreProfile);
    QSurfaceFormat::setDefaultFormat(glFormat);
    

    Now you should be able to use something like #version 330 core in your shader.

提交回复
热议问题