Are you asking us to tell you how your program is organized with respect to threads? (That&#39;s somewhat beyond the scope of the VTK mailing list.)<div><br></div><div>It sounds like your project might be better off single-threaded.<br>
<br></div><div>It would be better if you call UpdateMy3DObject from the same thread that actually does the rendering.<br><div><br></div><div><br><div class="gmail_quote">On Fri, May 15, 2009 at 10:59 AM, Giancarlo Amati <span dir="ltr">&lt;<a href="mailto:ilferraresebono@hotmail.it">ilferraresebono@hotmail.it</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">



<div>
Many thanks, <br><br>what I have is a mainWindow which has functions for rendering and then a thread that calls a kind of &quot;UpdateMy3Dobjects&quot; function which belongs to the mainWindow object. Now,<br>this &quot;UpdateMy3DObjects&quot; function works fine whenever that thread is not running while, I got the wglMakeCurrent error as soon as the thread runs the UpdateMy3Dobjects&quot; function.<br>
So,<br>as the UpdateMy3Dobjects function calls the RenderWindow-&gt;Render() method (renderwindow buidt in a QVTKWidget object of my GUI) calling that UpdateMy3DObject from the thread does correspond to a call form a thread different from the main one?<br>
In that case if I create a global variable, boolean for example which is true when I execute the UpdateMy3DObject function and false otherwise...would it help to synchronize these threads?<br><br>I checked out on the VTK documentation and I found the vktMutexLock class....and i tried to understand the example in the documetation which is a bit difficult honestly, but,....can that class be useful for my project?<br>
<br>many kind regards.<br>Giancarlo <br><br><hr>Date: Fri, 15 May 2009 10:19:51 -0400<br>Subject: Re: [vtkusers] threads and refreshing vtkRenderWindow<br>From: <a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a><br>
To: <a href="mailto:ilferraresebono@hotmail.it" target="_blank">ilferraresebono@hotmail.it</a><br>CC: <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><div><div></div><div class="h5"><br><br>I will not claim to be cleverer, but I think I can answer the question:<div>
<br></div><div>Your mistake is calling vtkObjects from multiple threads without synchonization objects. In general, vtkObjects are only safely accessible by one thread at a time. Multi-thread access means you will have to use some sort of mutexes or locks to guarantee that only one thread at a time will call vtkObject methods. Furthermore, you should only attempt to call Render from the main GUI thread of your application.</div>

<div><br></div><div><br></div><div>Hope this helps,</div><div>David</div><div><br><br><div>On Fri, May 15, 2009 at 9:25 AM, Giancarlo Amati <span dir="ltr">&lt;<a href="mailto:ilferraresebono@hotmail.it" target="_blank">ilferraresebono@hotmail.it</a>&gt;</span> wrote:<br>

<blockquote style="border-left:1px solid rgb(204, 204, 204);padding-left:1ex">



<div>
Hello vtkUSERS!!! This is an ash question for only the cleverer!! :D<br><br>I have a thread which modifies some data already in the vtkRenderWindow., now, the problem I have is when I want to refresh the window.<br>I though calling something like renderWindow-&gt;Render() or renderer-&gt;render(), but I get some error messages related to &quot;Resource already in use&quot; and &quot;wglMakeCurrent()&quot; function error.<br>

<br>Where is my mistake and any idea about how to overcome it?<br><br>Kind regards.<br><br>GC.<br><br><hr>Scrivi, parla e gioca con i tuoi amici! <a href="http://messenger.it/gioca.aspx" target="_blank">Scarica Messenger 2009!</a></div>


<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div><br></div></div><hr>Quali sono le parole pił cliccate? <a href="http://livesearch.it.msn.com/" target="_blank">Scopri la top!</a></div>
</blockquote></div><br></div></div>