Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Transition from Qt 5.2.1 to 5.5.1 opengl drawing in application fails
Forum Updated to NodeBB v4.3 + New Features

Transition from Qt 5.2.1 to 5.5.1 opengl drawing in application fails

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matt Minga
    wrote on last edited by
    #1

    I am currently working on upgrading from Qt 5.2.1 to 5.5.1. I was previously able to draw using opengl in qml. I am running Ubuntu 16.04. I based this heavily on the following example:

    http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

    The major difference is that I draw pixels from a buffer, and wound up using QOpenGLPaintDevice and qpainter to get what I needed. This worked for me until moving up to version 5.5.1. I get no output on the cmdline when the draw fails. Nothing show up on the screen that I am specifically drawing and the application does not crash. I am able to test whether it is functioning if I can do the following:

    if (!m_painter) {
        initializeOpenGLFunctions();
        m_painter = new QOpenGLPaintDevice(DEFAULT_WIDTH,DEFAULT_HEIGHT);
    }
    res=false;
    QPainter painter;
    res = painter.begin(m_painter);
    
    if (res == true)
        fprintf(stderr,"Worked\n");
    else
        fprintf(stderr,"Failed\n");
    
    painter.fillRect(0,0,DEFAULT_WIDTH,DEFAULT_HEIGHT, QBrush(Qt::blue));
    painter.end();
    return;
    

    If that snippet draws a background color I can see then that the application appears to function properly and will draw the samples I hand it later.

    Any ideas on what has changed from 5.2.1 to 5.5.1 that would cause that implementation to fail? The opengl in qml example functions regardless the version, but it is using a shader program.

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Any reason for using such an old version of Qt ? Can you check with a more recent version ? Current is 5.10.1 and LTS is 5.9.4.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Any reason for using such an old version of Qt ? Can you check with a more recent version ? Current is 5.10.1 and LTS is 5.9.4.

        M Offline
        M Offline
        Matt Minga
        wrote on last edited by
        #3

        @SGaist We were trying to stick with the latest version available from the Ubuntu repos. We just had an opportunity to move up from Ubuntu 14.04 to 16.04. Hence the qt version change. Seeing as we are making several changes, a wholesale change in the qt version will not be the biggest problem. I will pull down the LTS and and give that a shot and report back. Thank you for the input.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Matt Minga
          wrote on last edited by
          #4

          Version 5.9.4 did not make a difference in the behavior.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Can you setup a minimal sample application that reproduce that behaviour ?

            You should also take a look at the bug report system to see if you find anything related.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • timdayT Offline
              timdayT Offline
              timday
              wrote on last edited by timday
              #6

              Hmmm what you're seeing vaguely reminds me of experience developing&maintaining an app through from Qt4.x's "declarative" QML (with some custom OpenGL) through various Qt5.x versions up to and including the latest QtQuick. Initially with early versions in the Qt5.x series I used much the same approach as that example you link... but then around Qt5.3/5.4 or so I found it ran into problems (I forget the exact details and version) and ended up fixing them by migrating to using a QQuickFramebufferObject and QQuickFramebufferObject::Renderer instead.

              With hindsight... I'm guessing QSG was getting some scene-graph optimisations around then, and things like batching might have been changing the render order and leaving the OpenGL state in something different to what I had been in a previous version. Moving to a QQuickFramebufferObject might have separated things out better somehow, although it might not have actually been necessary if I'd known which bit of state needed prodding (but in the end it was a good change because it let us do much more fancy things with the OpenGL-rendered custom elements).

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved