QOpenGLWidget is getting black intermittently
-
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 ?
-
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 QWidgethope it clarifies, feel free if any doubt in description
highly appreciate any insight -
Do you have only one such QStackedWidget ?
-
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. -
So one single instance of it ?
-
@SGaist Yes
-
@JoeCFD These things i have already tried like clean the GL the update, also like viewport update etc.
-
Would it be possible to create a minimal compilable example that triggers this issue ?
-
@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.
-
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 ? -
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 ?@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.
-
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.