diff --git a/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx b/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx index 037b2ba226ff79adc6a168f344ee8af90f2a4cb5..d298bd09e2a432b2d27bd908d7d5a74e7208a439 100644 --- a/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx +++ b/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx @@ -1356,8 +1356,13 @@ bool vtkXOpenGLRenderWindow::EnsureDisplay() this->DisplayId = XOpenDisplay(static_cast<char*>(nullptr)); if (this->DisplayId == nullptr) { - vtkWarningMacro(<< "bad X server connection. DISPLAY=" - << vtksys::SystemTools::GetEnv("DISPLAY")); + // Only warn about DISPLAY if on-screen rendering is selected, + // this helps with automatic detection of best window backend. + if (this->ShowWindow) + { + vtkWarningMacro(<< "bad X server connection. DISPLAY=" + << vtksys::SystemTools::GetEnv("DISPLAY")); + } } else {