diff --git a/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx b/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx index b558241711f..9faaf935529 100644 --- a/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx +++ b/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx @@ -213,6 +213,11 @@ void QVTKOpenGLNativeWidget::initializeGL() { Q_ASSERT(this->RenderWindowAdapter.data() == nullptr); + auto ostate = this->RenderWindow->GetState(); + ostate->Reset(); + // By default, Qt sets the depth function to GL_LESS but VTK expects GL_LEQUAL + ostate->vtkglDepthFunc(GL_LEQUAL); + // When a QOpenGLWidget is told to use a QSurfaceFormat with samples > 0, // QOpenGLWidget doesn't actually create a context with multi-samples and // internally changes the QSurfaceFormat to be samples=0. Thus, we can't diff --git a/GUISupport/Qt/QVTKOpenGLWindow.cxx b/GUISupport/Qt/QVTKOpenGLWindow.cxx index c6398c0384d..b1e8d5bf9ed 100644 --- a/GUISupport/Qt/QVTKOpenGLWindow.cxx +++ b/GUISupport/Qt/QVTKOpenGLWindow.cxx @@ -203,6 +203,12 @@ void QVTKOpenGLWindow::initializeGL() if (this->RenderWindow) { Q_ASSERT(this->RenderWindowAdapter.data() == nullptr); + + auto ostate = this->RenderWindow->GetState(); + ostate->Reset(); + // By default, Qt sets the depth function to GL_LESS but VTK expects GL_LEQUAL + ostate->vtkglDepthFunc(GL_LEQUAL); + this->RenderWindowAdapter.reset( new QVTKRenderWindowAdapter(this->context(), this->RenderWindow, this)); this->RenderWindowAdapter->setDefaultCursor(this->defaultCursor());