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

QOpenGLWidget and specific functions version ?



  • Hey

    I'm trying to set up my openGL to use specific version & get functions from it... So

    //// Set format in constructor
    myGl::myGl(){
        QSurfaceFormat format;
        format.setMajorVersion(4); //whatever version
        format.setMinorVersion(5); //
        format.setProfile(QSurfaceFormat::CoreProfile);
        QSurfaceFormat::setDefaultFormat(format);
    }
    myGl::initializeGL(){
        makeCurrent(); /// Just to be sure...
        mFunctions = new QOpenGLFunctions_4_5_Core(); //// specify functions version ?
        mFunctions->initializeOpenGLFunctions(); /// crash ?
    }
    ////
    FATAL: ASSERT: "QOpenGLFunctions::isInitialized(d_ptr)" in file c:\users\qt\work\qt\qtbase\include\qtgui\../../src/gui/opengl/qopenglfunctions.h, line 887
    (c:\users\qt\work\qt\qtbase\include\qtgui\../../src/gui/opengl/qopenglfunctions.h:887, (null))
    

    I wish to have the specific functions as member in order to pass it to my scene manager to get called from rather than inheriting QOpenGLFunctions_xx a number of times in different nodes...

    Initially I tried this but this seems to not be compatible(?)

        mFunctions = context()->functions();
    or
        mFunctions = static_cast<QOpenGLFunctions_4_5_Core*>(context()->functions());
    

    What am I doing wrong here?

    I noticed that QOpenGLFunctions seems to not have some openGL calls, so I pass the specific version to all my nodes that needs access to it... unless ?

    I followed this topic but seem to not work? https://stackoverflow.com/questions/28235640/using-latest-opengl-functions-across-classes-in-qt-5-4


Log in to reply