vtkGenericOpenGLRenderWindow::Render() fails - how to use this class properly?

I’m running vtk-9.0.1 on ubuntu 20.04.5.

Can someone please refer me to an example that uses vtkGenericOpenGLRenderWindow properly?

MyClass has a member called renderWindow_ wich points to a vtkGenericOpenGLRenderWindow. I find that when my code calls renderWindow_->Render(), the graphics aren’t drawn. Stepping into renderWindow_->Render() with the debugger shows that the vtk code tries to make the render window current, but this fails and Render() returns without drawing graphics:


207 if (this->ReadyForRendering)

(gdb) n

209 this->MakeCurrent();

(gdb) n

210 if (!this->IsCurrent())

(gdb) n

212 vtkLogF(TRACE, "rendering skipped since `MakeCurrent` was not successful.");

What could cause MakeCurrent() to fail? The vtkGenericOpenGLRenderWindow documentation for MakeCurrent() says “It is the class user’s responsibility to watch for WindowMakeCurrentEvent and set it current.” So my code needs a callback that is invoked when WindowMakeCurrentEvent occurs - but what exactly should my code set to “current” when I receive the WindowMakeCurrentEvent? The documentation for IsCurrent() is also not clear to me - it says “It is the class user’s responsibility to watch for WindowIsCurrentEvent and set the bool* flag passed through the call data parameter.” I don’t understand understand - what should I do with this flag?

Thanks!