[vtkusers] How to "undo" GetRenderWindow()->Render()?

Dan Lipsa dan.lipsa at kitware.com
Mon Jan 16 15:08:23 EST 2017


Can you load your app in the debugger to see where the crash happens?

the 'maximum number of clients' error might be because you don't close the
X window when you close a tab.
Instead of just setting the view to nullptr try to delete the view as well.

Dan


On Mon, Jan 16, 2017 at 4:48 AM, Jan Niklas Hasse <jan-niklas.hasse at stw.de>
wrote:

> Hi Dan,
>
> yes, kind of. The problem is, that with a lot of tabs I'm getting:
>
> Maximum number of clients reached
> ERROR: In [...]/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 530
> vtkXOpenGLRenderWindow (0x32b207d0): bad X server connection. DISPLAY=:0.
> Aborting.
>
> calling chart->SetVisible(false) doesn't help unfortunately. I need to
> completely destroy the view somehow in hideEvent.
>
> Thanks
> Jan
>
> On Fri, 18 Nov 2016, at 14:57, Dan Lipsa wrote:
> > Jan,
> > To hide items in a scene you have to  call SetVisible(false) on them. Is
> this what you are trying to do?
> >
> > Dan
> >
> >
> >
> > On Fri, Nov 18, 2016 at 5:51 AM, Jan Niklas Hasse <
> jan-niklas.hasse at stw.de> wrote:
> >> Hi,
> >>
> >>  I'm using VTK 6.2 with Qt. I've created a class Plot2D which inherits
> from QVTKWidget. I now have a lot of these plots widgets in a tabbed view
> and want to only render the ones that are currently visible (otherwise I
> get an OpenGL crash).
> >>
> >>  void Plot2D::showEvent(QShowEvent*) {
> >>      view = vtkSmartPointer<vtkContextView>::New();
> >>      view->GetRenderer()->SetBackground(1,1,1);
> >>      view->SetRenderWindow(GetRenderWindow());
> >>      view->GetRenderWindow()->SetSize(width(),height());
> >>      view->GetScene()->AddItem(chart);
> >>      view->GetRenderWindow()->SetMultiSamples(0);
> >>      view->GetRenderWindow()->Render();
> >>  }
> >>
> >>  void Plot2D::hideEvent(QHideEvent*) {
> >>      view = nullptr;
> >>  }
> >>
> >>  Unfortunately, deleting the vtkContextView isn't enough: The next time
> showEvent is called, I get a crash inside VTK because it seems that
> view->GetRenderWindow()->Render(); has set up some kind of timer in the
> background. How would I solve this?
> >>
> >>  Thanks in advance :)
> >>  Jan
> >>  _______________________________________________
> >>  Powered by www.kitware.com
> >>
> >>  Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
> >>
> >>  Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >>  Search the list archives at: http://markmail.org/search/?q=vtkusers
> >>
> >>  Follow this link to subscribe/unsubscribe:
> >>  http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170116/02bed140/attachment.html>


More information about the vtkusers mailing list