Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsView with OpenGL backend
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView with OpenGL backend

Scheduled Pinned Locked Moved General and Desktop
14 Posts 2 Posters 8.9k Views 1 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.
  • V Offline
    V Offline
    VitorAMJ
    wrote on last edited by
    #2

    Did you try to clear the depth buffer also?

    @glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);@

    Regards,
    VitorAMJ

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mickaelP
      wrote on last edited by
      #3

      Thanks for the suggestion. I tried that but it doesn't help. Changing states still produce holes.

      One solution could be to force a full repaint every state changes but I think it could be expensive on the real application.

      Mickael

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VitorAMJ
        wrote on last edited by
        #4

        Did you enabled the GL_DEPTH_TEST?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VitorAMJ
          wrote on last edited by
          #5

          Check this "page":http://doc.qt.nokia.com/qq/qq26-openglcanvas.html also

          1 Reply Last reply
          0
          • V Offline
            V Offline
            VitorAMJ
            wrote on last edited by
            #6

            Maybe its not related, but there is also "these":http://stackoverflow.com/questions/274410/opengl-background-transparency clues

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mickaelP
              wrote on last edited by
              #7

              Actually, I think QGraphicsView is not supposed to clear the entire screen on each paint event because it only paints portion of the screen beeing updated. By using glclear it breaks its way of painting and do not know it should repaint all objects and so leaves holes. This can be solved by setting :
              @setViewportUpdateMode(QGraphicsView::FullViewportUpdate);@

              Finally, I think the real issue is how to clear updated regions with a transparent OpenGL background.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                VitorAMJ
                wrote on last edited by
                #8

                Your problem, as the image shows, seems to be some sort of Z fight.
                It is in fact panting the background (last image), but missing who comes first or something on that area of wrongly blue background.

                Can you provide your code so that I can play with it?

                Thanks,
                VitorAMJ

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mickaelP
                  wrote on last edited by
                  #9

                  Thanks for your help.

                  You can download my test case here : http://www.megaupload.com/?d=51WDQWF1
                  Actualy, it's a slight modification of the ported canvas example from QT SDK.
                  You'll need at least windows vista to run it.

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    VitorAMJ
                    wrote on last edited by
                    #10

                    That's just bad. Same happening to me...

                    As you noticed, the behavior of the program changes when you change from
                    @ QApplication::setGraphicsSystem("opengl");@
                    to
                    @ QApplication::setGraphicsSystem("raster");@
                    This points to a bug. You can use JIRA to report it.

                    As you also point out, here the error also vanishes when setting
                    @ setViewportUpdateMode(QGraphicsView::FullViewportUpdate);@
                    at the cost of updating everything.

                    I have tried several things, that you probably have also tried. I have set a QGLWidget to the viewport of the GraphicsScene using:
                    @ QApplication::setGraphicsSystem("raster");@
                    +
                    @setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));@
                    But then there is no cool background anymore. Not supported, it seems.

                    I have tried to add states to the qml to force the updates of the rectangles, but it doesn't work either.

                    I am trying some more stuff to get around the bug later,

                    Regards,
                    VitorAMJ

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mickaelP
                      wrote on last edited by
                      #11

                      Yes, it seems there is no clean solution to this issue.

                      Thanks anyway for trying.

                      Regards,
                      Mickael

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        VitorAMJ
                        wrote on last edited by
                        #12

                        Mistery resolved, it is a "known bug":http://developer.qt.nokia.com/faq/answer/opengl_and_translucent_background_do_not_work_together_due_to_a_limitation.
                        The bug was reported "here":http://bugreports.qt.nokia.com/browse/QTBUG-19412

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mickaelP
                          wrote on last edited by
                          #13

                          Well, I guess I'll use the glClear + fullViewportUpdate option.

                          1 Reply Last reply
                          0
                          • V Offline
                            V Offline
                            VitorAMJ
                            wrote on last edited by
                            #14

                            if you have a not that complex scene (like few rectangle areas) raster might be an option. Otherwise (non-rectangular areas, rotated rectangles, and other stuff), OpenGL can be faster.

                            I hope they can solve this bug fast and with a good rendering solution. But I honestly don't believe that it will be much faster ( maybe even not faster) than your workaround. That because if they change only parts of the screen, the bootleneck will still be in the driver sending stuff and possible context changes (considering that the user has a somewhat good GPU).

                            Let's wait and see!

                            Regards,
                            VitorAMJ

                            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