Weird behavior with several QOpenGLWidgets and QVTKWidgets
-
Hello,
i have a GUI that has a QOpenGLWidget in it.
Further there are dialogs that have QVTKWidgets in them.
Now I get the weird behavior, that when I rotate the view in the QOpenGLWidget, then click on the dialog QVTKWidget and then back to the mainwindow GUI glGetFloatv(GL_MODELVIEW_MATRIX, matrix) returns a unit matrix instead of the actual rotated one.
There seems to be some cross-talk between the widgets.
Further there are QOpenGLWidgets in a dialog which sometimes stay black (however most of the time work)
Do I need to consider something special when working with several OpelGl-based Widgets? -
Solved the first problem myself.
there needs to be
QOpenGLWidget::makeCurrent();
inserted at the beginning of the mouseEvent() for the rotation.
Otherwise it might use the wrong context for the rotation.To solve the second problem (staying black) before creating the OpenGLDialog the surface Format has to be reset:
QSurfaceFormat fmt; QSurfaceFormat::setDefaultFormat(fmt);