[vtkusers] Multi-threaded VTK

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Jun 22 12:46:10 EDT 2011


On Wed, Jun 22, 2011 at 12:27 PM, Chris Volpe ARA/SED <cvolpe at ara.com> wrote:
> I’m trying to have an application that drives scene content change on its
> own, while still allowing the user to manipulate the scene with
> vtkRenderWindowInteractor. The approach I’m trying to use is to have the
> vtkRenderWindowInteractor run in a background thread, with some concurrency
> protection to keep it from invoking the rendering pipeline at the same time
> the main thread tries to do so. My application main thread creates all the
> vtk objects (actor, render window, renderer, interactor), registers a couple
> of callbacks for the interactor style’s StartInteractionEvent and
> EndInteractionEvent which lock and unlock a vtkCriticalSection,
> respectively, and then spawns a background thread in which the interactor is
> started. The main thread then, periodically, locks the critical section,
> makes scene changes, renders, and unlocks the critical section.
>
>
>
> Although this approach seems sound in principle, I’m encountering corruption
> that leads me to believe that there is some kind of pipeline manipulation
> occurring before processing the StartInteractionEvent that is conflicting
> with what I’m doing in my main thread. Can someone with detailed knowledge
> of pipeline bowels provide some insight as to what might be going on, and
> perhaps provide an alternate course of action?

Do you produce new vtk objects in the background thread? If yes do you
use vtkSmartPointer? That could be cause of the problem depending on
how you are passing vtk objects from one thread to another.

Also it might help if you can attach a minimal code to reproduce the behavior.

Thanks


>
>
>
> Thanks,
>
>
>
> Chris
>
> --
> Christopher R. Volpe,
> Ph.D.                                                           Email:
> cvolpe at ara.com
>
> Senior Scientist, Information Exploitation Systems             Main Desk:
> 919-582-3300
>
> Applied Research Associates,
> Inc                                                     Direct: 919-582-3380
>
> 8537 Six Forks Rd., Suite
> 6000                                                            Fax :
> 919-582-3301
>
> Raleigh, NC 27615                                         Web:
> http://www.ara.com/offices/NC.htm
>
>
>
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com



More information about the vtkusers mailing list