[vtkusers] Multithreading & vtkRenderWindowInteractor

Nigel Nunn nNunn at ausport.gov.au
Thu Jan 20 11:41:32 EST 2005

Hi Thomas,

> -----Original Message-----
> From: ttickle [mailto:ttickle at cs.uno.edu]
> Sent: Thursday, 20 January 2005 8:36 AM
> To: vtkusers at vtk.org
> Subject: [vtkusers] Multithreading & vtkRenderWindowInteractor
>     I am writing a program which will have realtime updates to the
> displayed data under C++ using VTK under Windows.  I have tried using
> a vtkRenderWindowInteractor.  Unfortunatly, vtkRenderWindowInteractor
> only seems to preform updates when the user is interacting with the
> scene.  I need to refresh the window anytime my data changes.  At
> the present time, I am trying to following solution:
>     Create the window, interactor, and renderer and associate
> appropriatly.   Then create my worker thread whose job it will
> be to periodically update the vtkActors which are being displayed. 
> I then start the interactors event loop with interactor->Start();. 
> I have tried having the thread update the screne by calling the
> render methods of both vtkRenderWindowInteractor and vtkRenderWindow
> (not at the same time of course).  However, I get error messages
> related to something about wgl not being able to make the current
> context.  Can anyone show me some code or suggest how I can both
> use an Interactor with a scene that must be updated even when the
> user is not interacting with the data scene?
> Thanks in advance.
> Thomas Tickle

Hi Thomas,

Sounds like you're getting a worker thread to manipulate
vtkActors belonging to a pipeline owned by some object on
another thread.

A safe way to do this is to store simulation results in
some globally accessible object (protected by appropriate
flags or mutex object), then send a message from the worker
thread to the GUI interface, that new results are available.

Vtk pipelines on the GUI thread can then update themselves.


DON'T MISS OUR SPORTING FUTURE 2005! Early bird registration closes 2 February!
Australia's premier sport development forum will be held in Sydney from 2-4 March 2005.
Registration forms and program information is available at: http://www.ausport.gov.au/events/osf2005
This message is intended for the addressee named and may contain confidential
and  privileged information. If you are not the intended recipient please note that
any form of distribution, copying or use of this communication or the information
in it is strictly prohibited and may be unlawful. If you receive this message in error,
please delete it and notify the sender.
Keep up to date with what's happening in Australian sport. Visit www.ausport.gov.au

More information about the vtkusers mailing list