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

QOpenGLContext does not works in debug with QtCreator 4.7



  • Hi,
    I update Qt creator to version 4.7 (windows) and know my application does not work correctly because QOpenGLContext seems dont' work in debug now.

    In Qt Creator 4.6 I had no problem

    QSurfaceFormat format;
            format.setMajorVersion(10);
            format.setProfile(QSurfaceFormat::CoreProfile);
            QOffscreenSurface offscreen;
            offscreen.setFormat(format);
            offscreen.create();
            QOpenGLContext ctxt;
            ctxt.setFormat(format);
            ctxt.create();
            QOpenGLContext* pCurrent = QOpenGLContext::currentContext();
    
            if(ctxt.makeCurrent(&offscreen))
            {
    //
            }
    

    works well with Qt creator 4.6, in 4.7 pCurrent is null and make current return false.
    The problem is only in debug mode
    in realease it works fine.
    Is it a known bug.
    How can I return to version 4.6 ?
    thanks.


  • Lifetime Qt Champion

    hi
    But Qt Creator is a Text editor. its not the Qt version.
    Did you also upgrade your Qt ?


  • Lifetime Qt Champion

    Hi,

    You can check the bug report system to see if there's something related.

    As for older versions of Qt Creator, you can find them here.



  • I said QtCreator, I mean the Qt CDB debugger 4.7, I'm currently in Qt 5.11.0 I will update to 5.11.1



  • same trouble in Qt 5.11.1



  • I made a test:

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        QString openGLVers;
        QString openGLVendor;
        QString openGLRenderer;
        QString openGLExtension;
    
    
        QSurfaceFormat format;
        format.setMajorVersion(4);
        format.setProfile(QSurfaceFormat::CoreProfile);
        QOffscreenSurface offscreen;
        offscreen.setFormat(format);
        offscreen.create();
        QOpenGLContext ctxt;
        ctxt.setFormat(format);
        ctxt.create();
        QOpenGLContext* pCurrent = QOpenGLContext::currentContext();
    
        if(ctxt.makeCurrent(&offscreen))
        {
            openGLVers = QString((char*)ctxt.functions()->glGetString(GL_VERSION));
            openGLVendor = QString((char*)ctxt.functions()->glGetString(GL_VENDOR));
            openGLExtension = QString((char*)ctxt.functions()->glGetString(GL_EXTENSIONS));
            openGLRenderer =  QString((char*)ctxt.functions()->glGetString(GL_RENDERER));
    
            qDebug() << openGLVers;
            qDebug() << openGLVendor;
            qDebug() << openGLExtension;
            qDebug() << openGLRenderer;
    
            ui->lblRenderer->setText(openGLRenderer);
            ui->lblVendor->setText(openGLVendor);
            ui->lblVer->setText(openGLVers);
        }
    }
    

    Doest not work in debug and release (if launch from QtCreator)
    I have error QWindowsEGLContext: Failed to create context, eglError: 3005, this: 0x5ac3470

    If I launch my small exe from explorer It works.



  • I confirm it's a bug (I rebuild with QtCreator 4.6.2 and it's works).
    thanks for the link to QtCreator 4.6.2


  • Lifetime Qt Champion

    @Roy44
    But still Qt 5.11.1 ?



  • I'm stll in Qt 5.11.1.



  • I found a similar problem here
    https://forum.qt.io/topic/92780/shader-fails-to-compile-after-upgrading-to-qt-creator-4-7/6

    And the same solution solve my problem.


Log in to reply