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. QOpenGLWidget is getting black intermittently
Forum Updated to NodeBB v4.3 + New Features

QOpenGLWidget is getting black intermittently

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 3 Posters 1.2k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    What is a QGLWindow ? I know QWindow, the deprecated QGLWidget, QOpenGLWidget but not that one.

    Something is not clear on your description, how many of these do you have ?

    How are you implementing the switching ?

    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
    • S Offline
      S Offline
      Shivendra Pratap Singh
      wrote on last edited by
      #3

      Hi
      My mistake its QOpenGLWidget
      and we are using the QStackedWidget which consist of QOpenGLWidget and QWidget and for switching we are just changing the current index between 0 and 1
      i.e. GetDrawingArea()->setCurrentIndex( show ? 1 : 0 )
      here GetDrawingArea return stack 1 represent QOpenGLWidget and 0 represent QWidget

      hope it clarifies, feel free if any doubt in description
      highly appreciate any insight

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

        Do you have only one such QStackedWidget ?

        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
        • S Offline
          S Offline
          Shivendra Pratap Singh
          wrote on last edited by
          #5

          Yes, it is a common QStackedWidget that is used on all the pages of the application.
          we just change the gl_scene that needs to be drawn as per the particular page.

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

            So one single instance of it ?

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

            S 1 Reply Last reply
            0
            • JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #7

              can you try to call update() of QOpenGLWidget to force repaint after switch?

              S 1 Reply Last reply
              0
              • SGaistS SGaist

                So one single instance of it ?

                S Offline
                S Offline
                Shivendra Pratap Singh
                wrote on last edited by
                #8

                @SGaist Yes

                1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  can you try to call update() of QOpenGLWidget to force repaint after switch?

                  S Offline
                  S Offline
                  Shivendra Pratap Singh
                  wrote on last edited by
                  #9

                  @JoeCFD These things i have already tried like clean the GL the update, also like viewport update etc.

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

                    Would it be possible to create a minimal compilable example that triggers this issue ?

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

                    S 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Would it be possible to create a minimal compilable example that triggers this issue ?

                      S Offline
                      S Offline
                      Shivendra Pratap Singh
                      wrote on last edited by
                      #11

                      @SGaist Sorry actually it is not reproducible in a normal scenario.

                      Let me try to explain simply as I can.

                      • In our application, we are using a single StackWidget across the app the only thing that is changing is on every page we are creating a new QOpenGLWidget and new QWidget to attach to the stack for specified page in the application.
                      • Then we create a respecting GLDrawerScene for that widget.
                      • So in an erroneous scenario, we are moving on four buttons each having its own scene, for three buttons we are not trying to hide the GLWidget when we leave but in 1 particular button when we leave we hide the GLwidget.
                      • Right now we are on a model dialog but when we move the focus frequently on it the GLWidget in the back of the screen is getting black.
                      • And also if we move to previous pages their GL scene also becomes black and it remain black no matter what, if you want to correct the behaviour you need to restart the application.

                      My guess is paintGL and paintEvent calls are somehow getting into conflict and they stop drawing all together.

                      I want to know in what scenario this could happen like when can QOpenGLWidget becomes black.

                      and its not the graphic card issue else it would have come to any of the pages in the application rather than at specific step.

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

                        How many QOpenGLWidget are you creating during an application run ?

                        Are you disposing of them ? If so how ?
                        Do you have specific resources associated with these widgets ?

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

                        S 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          How many QOpenGLWidget are you creating during an application run ?

                          Are you disposing of them ? If so how ?
                          Do you have specific resources associated with these widgets ?

                          S Offline
                          S Offline
                          Shivendra Pratap Singh
                          wrote on last edited by
                          #13

                          @SGaist
                          Sorry, it's getting very confusing right now for both of us.

                          Let me try to put my problem in a simple scenario-

                          If we create a QStackWidget and associate 2 pages with it 1- QOpenGLWidget 2-QWidget.

                          and try to hide/show QOpenGLWidget and QWidget very frequently for some time, is there a scenario where Qt stops drawing/painting altogether because in a gist this is what is happening.

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

                            It should not.

                            Since it does not happen in standard use, one way to find what might posing problem is to disable all the code that is not related to that widget.

                            Once that is done, gradually add bad stuff until it breaks again.

                            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

                            • Login

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