Q: vtkMultiThreader. Threads. How to use? Example?

Nigel Nunn nNunn at ausport.gov.au
Thu Jul 1 11:56:13 EDT 1999


Lisa [lisa.avila at kitware.com] writes:

> I believe that on most platforms you can't use OpenGL 
> from more than one thread at a time (definitely not on
> the same context). 


Some good news for Win32 folk:

Apart from creating "worker threads" to perform some task 
without any user interface, we can also create "apartment" 
threads that get their own GUI and independent message pump.

A current prototype generates a sequence of vtkUnstructuredGrids,
some to display FEM meshes, others to allow real-time exploration 
of the solution fields.  Each is displayed in its own MFC-CView 
derived window, with full set of menus, toolbars, dialogs, etc.

No problem yet using four such 32-bit windows, each on their own
thread.  When multiple CPUs are available, this arrangement makes 
for a rich GUI experience  :-)

Since all the Vtk data structures are currently allocated within 
the one 2GB address space of a single Win32 process, lightweight 
CRITICAL_SECTIONs are sufficient to guard the data structures 
during concurrent access.

And all this on a humble 8MB Permedia 2 FireGL-1000, which I hear 
now sell for about US $50 !  (8MB ==> set resolution to 1024x768)

Thanks to 3DLabs for great OpenGL drivers,
Thanks to Kitware for Vtk,
Nigel


Lisa wrote:

> You should not have a problem having several 
> vtkRenderWindowInteractors in the same thread - so you 
> shouldn't need to worry about thread safeness for that. 
> As for your program going off and doing other stuff in 
> another thread it depends on what that other stuff is. 
> I believe that on most platforms you can't use OpenGL 
> from more than one thread at a time (definitely not on
> the same context). If you are not doing OpenGL and not 
> working on the same objects that the interactors are 
> displaying (or the entire pipeline up to that point) 
> then everything is fine. If you are altering the pipelines 
> or any of the objects in the pipelines from the other thread, 
> then it will be difficult or maybe even impossible without 
> adding mutex calls to the code to guarantee that two threads 
> don't collide.


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list