Qt6 topics merged with General

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); //

    Then in initializeGL() I would run this :

        mFunctions = new QOpenGLFunctions_4_5_Core();
        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
        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();
        mFunctions = 0;
        mFunctions = context()->versionFunctions<QOpenGLFunctions_4_5_Core>();
        if (!mFunctions) {
            qWarning() << "Could not obtain required OpenGL context version";

    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

  • Re: QtOpenGL is the most painful thing I ever did.

    @Dariusz I feel your pains where they come from..... I really feel you man.

    Toi be completely honest - its gotten to the point where I had to uninstall (its not even unistallation, rather manual removal as its uninstaller is.....well..... useless) Qt.

    Why is what it is? Because ...... its just it :)

    OK jokes aside: here is my story.

    Im member of a devteam for one of the larger ERP projects available (without giving names please)..... I was assigned task to give a Qt test-ride and - if Qt stand for what we need - buy a license...

    Easy as it sounds I downloaded Qt Installer (for OSS version), run it and here is where problems started, On the Qt-selection screen I checked what I needed (pretty much based on what was prechecked), let it install and ...... there was an error that installer is unable to continue due to <<error_code>>. Well, ok..... I googled error code.... gave me link to Jira. This bug is unresolved; whoa.... not even assigned !! All this after 2 years?! Seriously??

    So, I clicked ok, and what? Instaler finished installing Qt without errors (or at least it seems like there was no error).....till I started Qt. App refuses to start because of? It doesnt know (unspecified error).

    So Qt - that was it. Opened Explorer, deleted (manually) Qt folder and off it went. Qt no more.

  • @Dariusz said in 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.

    Man, I must have found my lost twin...that rant is worthy of something I'd write.

    But seriously, GL is not something that the typical hacker can expect to read a book on and start writing effectively. It is generally very low level and follows the hardware pipeline closely. Stick to the higher level abstractions unless you intend to become a GL expert. As a hiring lead I would overlook resumes of generic programmers who say "yeah, I can program opengl". I want to see several years of specific GL experience, showing that they understand the nuiances and change history.

  • Banned

    This post is deleted!

  • Banned

    This post is deleted!

Log in to reply