Thanks for the reply!  <div><br></div><div>Thats basically the conclusion I came too. My plan is to acquire the scene data in the main thread, then pass this on to any background worker thread. </div><div><br></div><div>Will I run into the same issues with modifying a collection of actors?  My intent is to have a collection of polydata objects updated in the background that are streamed into the viewer.  Do you think I&#39;ll hav issues with this?</div>
<div><br></div><div>Thanks</div><div>Justin<span></span><br><br>On Wednesday, May 9, 2012, Marcus D. Hanwell  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The VTK rendering classes are not thread safe, and we do not<br>
initialize OpenGL to render in a thread safe fashion. There are<br>
several methods that are likely to cause issues if called from<br>
multiple threads.<br>
<br>
You could communicate across threads but restrict the VTK calls to the<br>
main thread.<br>
<br>
Marcus<br>
<br>
On Sun, Apr 29, 2012 at 5:43 PM, Justin Rosen &lt;<a>jmylesrosen@gmail.com</a>&gt; wrote:<br>
&gt; Nevermind, bunch of print statements must of been slowing things down, it<br>
&gt; still crashes immediately without any print statements :(<br>
&gt;<br>
&gt; On Sun, Apr 29, 2012 at 2:38 PM, Justin Rosen &lt;<a>jmylesrosen@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Grabbing a copy of the camera in a separate thread seems to do the trick.<br>
&gt;&gt;  Can anyone shed some light onto this topic?<br>
&gt;&gt;<br>
&gt;&gt; vtkCamera *camera = vtkCamera::New();<br>
&gt;&gt; camera-&gt;ShallowCopy(renderer-&gt;GetActiveCamera());<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; Justin<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Sat, Apr 28, 2012 at 9:52 PM, Justin Rosen &lt;<a>jmylesrosen@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; It looks like vtkCamera-&gt;GetFrustumPlanes isn&#39;t thread safe?  It makes<br>
&gt;&gt;&gt; quite a few changes to some of the it&#39;s member variables.  I tried adding a<br>
&gt;&gt;&gt; mutex lock between vtkCommand::Start/EndEvent, but I&#39;m still seg faulting.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks,<br>
&gt;&gt;&gt; Justin<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sat, Apr 28, 2012 at 3:23 PM, Justin Rosen &lt;<a>jmylesrosen@gmail.com</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; If anyone one knows a bit about using vtk and boost threads I&#39;d really<br>
&gt;&gt;&gt;&gt; appreciate the help.  I&#39;m fairly new to vtk and threads in general and I&#39;m<br>
&gt;&gt;&gt;&gt; trying to figure out why calling vtkCamera-&gt;GetFrustumPlanes from a boost<br>
&gt;&gt;&gt;&gt; thread eventually segfaults.  It takes quite a few of iterations before the<br>
&gt;&gt;&gt;&gt; segfault occurs.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; The general idea is that I have main application UI and a worker thread<br>
&gt;&gt;&gt;&gt; in the background which&#39;ll be doing some processing (Eventually<br>
&gt;&gt;&gt;&gt; updating/modifying a list of actors).  At the moment I&#39;m just trying to get<br>
&gt;&gt;&gt;&gt; the cameras view frustum...<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; If I remove the call to camera-&gt;GetFrustumPlanes the application runs<br>
&gt;&gt;&gt;&gt; without seg faulting.  Any idea what I may be doing wrong?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; void workerFunc(vtkCamera *camera)<br>
&gt;&gt;&gt;&gt; {<br>
&gt;&gt;&gt;&gt;   double prevUp[3] = {0, 0, 0};<br>
&gt;&gt;&gt;&gt;   double prevFocal[3] = {0, 0, 0};<br>
&gt;&gt;&gt;&gt;   double prevPos[3] = {0, 0, 0};<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;   while(true){<br>
&gt;&gt;&gt;&gt;     double *up = camera-&gt;GetViewUp();<br>
&gt;&gt;&gt;&gt;     double *focal = camera-&gt;GetFocalPoint();<br>
&gt;&gt;&gt;&gt;     double *pos = camera-&gt;GetPosition();<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;     bool viewpointChanged = false;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;     // Check up vector<br>
&gt;&gt;&gt;&gt;     if(up[0] != prevUp[0] || up[1] != prevUp[1] || up[2] != prevUp[2])<br>
&gt;&gt;&gt;&gt;       viewpointChanged = true;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;     // Check focal point<br>
&gt;&gt;&gt;&gt;     if(focal[0] != prevFocal[0] || focal[1] != prevFocal[1] || focal[2]<br>
&gt;&gt;&gt;&gt; != prevFocal[2])<br>
&gt;&gt;&gt;&gt;       viewpointChanged = true;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;     // Check position<br>
&gt;&gt;&gt;&gt;     if(pos[0] != prevPos[0] || pos[1] != prevPos[1] || pos[2] !=<br>
&gt;&gt;&gt;&gt; prevPos[2])<br>
&gt;&gt;&gt;&gt;       viewpointChanged = true;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;     // If the viewpoints changed get the cameras frustum<br>
&gt;&gt;&gt;&gt;     if (viewpointChanged){<br>
&gt;&gt;&gt;&gt;       prevUp[0] = up[0]; prevUp[1] = up[1]; prevUp[2] = up[2];<br>
&gt;&gt;&gt;&gt;       prevFocal[0] = focal[0]; prevFocal[1] = focal[1]; prevFocal[2] =<br>
&gt;&gt;&gt;&gt; focal[2];<br>
&gt;&gt;&gt;&gt;       prevPos[0] = pos[0]; prevPos[1] = pos[1]; prevPos[2] = pos[2];<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;       cout &lt;&lt; &quot;View Changed&quot; &lt;&lt; endl;<br>
&gt;&gt;&gt;&gt;       cout &lt;&lt; &quot;Up: &lt;&quot; &lt;&lt; up[0] &lt;&lt; &quot;, &quot; &lt;&lt; up[1] &lt;&lt; &quot;, &quot; &lt;&lt; up[2] &lt;&lt; &quot;&gt;&quot;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
</blockquote></div>