[vtkusers] invalid drawable ; Mac OSX Mavericks and vtk 6.1

David Gobbi david.gobbi at gmail.com
Mon Jul 28 18:56:04 EDT 2014


Hi Totte,

This error occurs when you call Render() on a vtkRenderWindow when
the window has not yet been mapped to the screen. The most common
case is when VTK is used with Qt and the render window is inside a Qt
widget that is not yet visible.  The way that I avoid 'invalid drawable' is
by doing a "widget->isVisible()" check on my Qt widget before every
call to "renderwindow->Render()":

  if (widget->isVisible()) {
    renderwindow->Render();
  }

At the very least, you need some kind of check to make sure that
Render() is never called before the widget becomes visible.

 - David

On Mon, Jul 28, 2014 at 4:03 PM, Totte Karlsson <tottek at gmail.com> wrote:
> Hello,
> I have some vtk code that works fine under windows and linux. I have tried
> to port this code to the Mac. Originally I used vtk 5.10 and the first
> problem I detected was a 'invalid drawable' error occurring.
>
> Googling around, many people have observed the 'invalid drawable' problem. I
> thought it would be a problem fixed in vtk 6.1, so I updated my code to use
> 6.1. However, I now see the problem is still present in 6.1.
>
> I have code that allow the user to do some window interaction, and press
> 'e', for exit, and then, 'restart' the interaction mode. This seem to
> trigger the 'invalid drawable' error.
>
> For me this is a show stopper and I have not yet seen any solution to this
> problem.
>
> There are suggestions on the vtk wiki to 'restructure the code' to 'make the
> window visible' prior to rendering.
> http://www.vtk.org/Wiki/VTK/OpenGL_Errors) . But there is no explanation on
> that page what that means? Anyone knowing?
>
> The other two bullets on that page are to no help either I am afraid. I
> can't ignore the error by the cmake variable. There seem not to be any need
> to detect the 'invalid drawable' condition, since I don't know what to do at
> that point to make it valid.
>
> What seem to be needed is to create a state of 'valid drawable'. Question is
> how to do that.
>
> Any help appreciated. I suppose this must bite many mac people.
>
> tk


More information about the vtkusers mailing list