[vtkusers] vtkRenderWindow::SetExitMethod to close vtkRenderWindow

William A. Hoffman billlist at nycap.rr.com
Fri Oct 26 12:19:50 EDT 2001


VTK callback functions are all C functions and can not be member functions.
To call a member function, you have to create a "C" function that calls the 
member funciton:

Something like this:

void newExtiMethod(void* arg)
{
static_cast<classname*>(arg)->newExitMethod();
}

At 11:43 AM 10/26/2001 -0400, Anwar Upal wrote:
>Hi all:
>
>My GUI interface gives control to VTK to render a model and I would like 
>to gain control after the rendering is done.
>
>I have defined a newExitMethod in the class that also includes the 
>function which calls the vtkRenderWindowInteractor. The newExitMethod 
>structure looks like:
>
>         void classname::newExitMethod(void *arg)
>         {
>         }
>
>And the code that calls vtkRenderWindowInteractor is as shown below:
>
>         vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>         iren->SetExitMethod (newExitMethod,NULL);
>
>However, the gcc compiler gives the following error:
>
>         "no matching function for call to 
> `vtkRenderWindowInteractor::SetExitMethod (const char[14], NULL)'
> 
>/usr/local/ces/sunos/include/vtk/graphics/vtkRenderWindowInteractor.h:212: 
>candidates are:
>         void vtkRenderWindowInteractor::SetExitMethod(void (*)(void 
> *),         void *)"
>
>How can I fix this error? And what should my custom method newExitMethod 
>do to give me back control (and just close the vtk window instead of 
>terminating my application and user interface).
>
>Please help.
>
>from Anwar
>
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic. 
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list