Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QOpenGLShader: could not create shader



  • Hi,

    I created MyGLWidget like:
    class MyGLWidget: public QOpenGLWidget, protected QOpenGLFunctions
    {
    Q_OBJECT
    public:
    MyGLWidget: ();
    protected:
    void initializeGL() Q_DECL_OVERRIDE;
    }
    void MyGLWidget::initializeGL()
    {
    initializeOpenGLFunctions();

    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    
    glEnable(GL_TEXTURE_2D);
    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
    glDepthFunc(GL_LEQUAL);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    m_v = new QOpenGLShader(QOpenGLShader::Vertex);
    m_f = new QOpenGLShader(QOpenGLShader::Fragment);
    

    }

    When I ran this code on Qt from qt-opensource-windows-x86-mingw492-5.6.2.exe, it run without any issue.
    But when I run it on Qt built by myself statically, it gives me an error message:
    """
    QOpenGLShader: could not create shader
    QOpenGLShader: could not create shader
    """
    I am not sure what cause this runtime error.

    When I built static-Qt, I used the following configuration and mingw64.
    configure -prefix C:\Qt\5.6.2 -static -release -platform win32-g++ -nomake examples -nomake tests -opengl desktop
    Do I have to configure differently to fix this problem?


Log in to reply