<pre><tt><tt>Hi,<br><br>I have the following problem and I am wondering if someone could help <br>me.<br><br>I'm implementing a specific Widget like a vtkXYPlotwidget but, the <br>result should<br>be rendered on a separeted vtkRenderWindow instead of the ParaView's <br>viewport.<br><br>I can implement the widget using one thread for each window and that <br>window<br>doesn't block Paraview's interaction. Both works.<br><br>The problem is that I can open only one window each time. If I try to <br>open<br>multiple windows, I can only close them in the inverse order that I <br>opened.<br><br>For example:<br> Creating: Create window 1<br> Create window 2<br> Deleting: Close window 2<br> Close window 1<br><br>Anyone knows why I have problems when closing the first window before <br>the<br>second?<br><br>The code used to open the window and the method of my thread is above:<br><br>//Method Thread.<br><br>void *ThreadFunction(void *arg)<br>{<br>
vtkHMXYPlot **localXYplot;<br> localXYplot = (vtkHMXYPlot **) arg;<br> <br> vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New(); <br> <br> vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br> <br> vtkRenderer *renderer = vtkRenderer::New();<br> <br> //Configuring the renderwindow.<br> renderWindow->SetSize(500, 400);<br> renderWindow->SetWindowName("HeMoLab 2D Plot.");<br> <br> //Configuring the renderer.<br> renderer->SetBackground(0,0,0);<br> <br> renderer->AddActor2D(localXYplot[0]);<br> renderer->AddActor2D(localXYplot[1]);<br> renderer->AddActor2D(localXYplot[2]);<br><br> renderWindow->AddRenderer(renderer);<br> interactor->SetRenderWindow(renderWindow);<br> interactor->Initialize();<br> renderWindow->Render();<br> interactor->Start();<br><br> localXYplot[0]->Delete();<br> localXYplot[1]->Delete();<br> localXYplot[2]->Delete();<br> <br> interactor->Delete();<br>
renderer->Delete();<br> renderWindow->Delete();<br> std::cout << "Thread Finished!!!" << endl;<br> //pthread_exit((void*)arg);<br> pthread_exit(NULL);<br>}<br><br><br><br>Methodo Que cria as threads.<br>void vtkHMXYPlotWidget::ShowHMXYPlotWidget(vtkHMXYPlot **xyplot)<br>{<br> int i, rc, rc2;<br> <br> int PTHREAD_CREATE_DETACHED, PTHREAD_SCOPE_PROCESS;<br> <br> pthread_t id;<br> pthread_attr_t attr;<br> <br> pthread_attr_init(&attr);<br> pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);<br> pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);<br> rc = pthread_create(&id, &attr, ThreadFunction, (void *) xyplot);<br><br>}<br></tt></tt></pre><BR><BR>/( )`<br> \ \___ / |<br> /- _ `-/ '<br> (/\/ \ \ /\<br> / / | ` \<br> O O ) / |<br>
`-^--'`< '<br> (_.) _ ) /<br> `.___/` / <br> `-----' /<br> <----. __ / __ \<br> <----|====O)))==) \) /====<br> <----' `--' `.__,' \<br> | |<br> \ / /\<br> ______( (_ / \______/<br> ,' ,-----' | Jan Palach, programador:<br> `--{__________) Python, C/C++<p> 
                <hr size=1>
<a href="http://us.rd.yahoo.com/mail/br/tagline/freeisp/*http://br.acesso.yahoo.com">Yahoo! Acesso Grátis</a> - Internet rápida e grátis. Instale o discador agora!