QtOpenGL is the most painful thing I ever did.



  • I hate it.
    I mean OMG I HATE IT!!!!

    Its so hard to use the bloody thing. Its as if it was intentionally made to be the most hardest "fuc%&ng" thing to use.

    say I make a inheritance of public QOpenGLWidget, public QOpenGLFunctions,. In constructor I go in and set :

        QSurfaceFormat format;
        format.setMajorVersion(4); //whatever version
        format.setMinorVersion(5); //
        format.setProfile(QSurfaceFormat::CoreProfile);
        format.setOption(QSurfaceFormat::DebugContext);
        QSurfaceFormat::setDefaultFormat(format);
        setFormat(format);
    

    Then in initializeGL() I would run this :

        initializeOpenGLFunctions();
        mFunctions = new QOpenGLFunctions_4_5_Core();
        mFunctions->initializeOpenGLFunctions();
        mFunctions->glEnable(GL_DEPTH_TEST);
        qDebug() << "renderGL::initializeGL" << context();
        qInfo() << "version: " << QLatin1String(reinterpret_cast<const char *>(glGetString(GL_VERSION)));
        qInfo() << "glsl version: " << QLatin1String(reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
        QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
        logger->initialize(); // initializes in the current context, i.e. ctx
        logger->enableMessages();
        logger->startLogging();
        connect(logger, &QOpenGLDebugLogger::messageLogged, this, &gltest::debugGLMsg);
    

    and then I get

    ######
    			WARNING: QOpenGLDebugLogger::initialize(): the current context is not a debug context:
        this means that the GL may not generate any debug output at all.
        To avoid this warning, try creating the context with the
        QSurfaceFormat::DebugContext surface format option.
     (opengl\qopengldebug.cpp:1386, bool __cdecl QOpenGLDebugLogger::initialize(void))
    ######
    

    WHAT THE FU"$"! SH"!$!" is this ?!

    I made it debug context 4 lines above!!! Wrrrrrrrrrrrrrrrrrrrrr

    And then I get crash because of some assert error inside qt source...

    I swear all the help QT tries to help, I just wish Qt would try to help a little less with openGL!!! ;[

    Another one fps, QopenGLWidget is limited to fps of application. Like it wont go above 30 or 60 that the app is set to. Or if I disable it, then etire app goes faster when I only need 1 window to behave faster I mean "AAAAAAAAAAAAAAA"!!!!!!!!!!!!!!!!!!!!

    rage...so much rage.....

    Am I the only one who rage 24/7 when ever I have to touch openGL in QT?!



  • @Dariusz said in QtOpenGL is the most painful thing I ever did.:

    mFunctions = new QOpenGLFunctions_4_5_Core();

    Don't do this. Instead inherit from QOpenGLFunctions_4_5_Core instead of QOpenGLFunctions. Then you can call opengl functions inside the class without an object. Also, this will limit you to desktop opengl if you don't already know.

    I haven't used the debug logger. No idea what is going on there.

    It might be a good idea to take a break, or do some exercise. I take walks at lunch for reasons like this. I looked at a lot of examples of other people's opengl qt programs. That might help with the frustration, get a fresh perspective. I found it somewhat verbose, but not very frustrating. There are examples in Qt Creator that might help.



  • Thanks. I'm losing my marbles now. everything is black!!!!

    But I did not think of inheriting from QOpenGLFunctions_4_5_Core for some reason...
    even so, if I wish to assign them to a member class, I can't, or can I ? How can I do it ?

    I need them as a member so I can pass to other classes but doing context()->function() return non "_4_5" ones... ehhhhh more rage! and I cant cast them sigh..

    I was about to go for a walk and cool down, just noticed reply so though it ping back :- )

    Thanks for hint!



  • @Dariusz said in QtOpenGL is the most painful thing I ever did.:

    doing context()->function() return non "_4_5"

    I will have to look at my code tonight. I have not looked in a while. I don't remember there being an issue with this.



  • I cooled down. A little... functions wise, sounds like this is the way to go :

    void mytest::initializeGL() {
        qDebug() << "init is being called?" << context();
        initializeOpenGLFunctions();
        mFunctions = 0;
        mFunctions = context()->versionFunctions<QOpenGLFunctions_4_5_Core>();
        if (!mFunctions) {
            qWarning() << "Could not obtain required OpenGL context version";
            exit(1);
        }
        mFunctions->glEnable(GL_DEPTH_TEST);
    

    In any case this seems great now. Except that my openGLWidget window is black. Not only that, every single app that was working 2h ago, is now black too. Nothing openGL related works. Amazing. Just amazing.

    Imma gonna reinstall my nvidia drivets, see if that help ? If that wont help then I dunno... game over? : )



  • @Dariusz said in QtOpenGL is the most painful thing I ever did.:

    every single app that was working 2h ago

    I hate it when I come up with an issue like that. You think you are fighting your code when you are fighting some glitch some place else. Sorry to hear that. I feel your pain!



  • @fcarney Its priceless.... gotta re-adjust every openGL based app to get something to work... my paintGL no longer gets called by qt :D


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.