<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Thank you Andrew i had forgotten that isolated ComputerRGB().<div><br></div><div>Forgive me i wasn't clear, but i added the observer to the celldata to render every time the cells are updated, and the interactions callbacks handle just the mutex to prevent the cells updates while i'm interaction.</div><div>Is there another way to do ?</div><div><br></div><div>Thank you again for your help.</div><div>Antonio Fortino</div><div><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2016-12-29 6:23 GMT+01:00 Andrew Maclean <span dir="ltr"><<a href="mailto:andrew.amaclean@gmail.com" target="_blank">andrew.amaclean@gmail.com</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"><br><div><div>Your problem is in the modified callback. There is no need for this callback since</div><div> while the rendering takes place this callback is invoked many times hence the OpenGL errors.</div><div> So remove: "cellData->AddObserver(vtkComm<wbr>and::ModifiedEvent,ModifiedCal<wbr>lback);" </div><div> By adding this observer to CellData you are forcing a reload of cell data whenever any event happens during rendering.</div><div><br></div><div>Now, you only need the InteractionEndCallBack observer since you are only interested in updating the end result.</div><div> If you leave in InteractionStartCallBack then the object is updated twice. Once at the start of interaction and then at the end of interaction.</div><div> After all you are only interested in the result after the interaction has ended.</div><div> Also remove "ComputerRGB();" on line 75 as this is not needed since this is called in the thread.</div><div><br></div><div>Addidionally </div><div>"#include <X11/Xlib.h>"</div><div>and</div><div>"XInitThreads();"</div><div><br></div><div>are not needed at all.</div></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">---------- Forwarded message ----------<br>From: Antonio Fortino <<a href="mailto:thoniorf@gmail.com" target="_blank">thoniorf@gmail.com</a>><br>To: <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>Cc: <br>Date: Wed, 28 Dec 2016 17:59:13 +0100<br>Subject: [vtkusers] update,interact and render in different threads<br></div></div><div dir="ltr"><div><div class="h5">Hello to everyone,<div><br></div><div>I'm trying to develop a simple example that update the celldata of a polydata in a thread while rendering in the main thread.</div><div>My final goal is to interact with the scene, and pause the updates.</div><div><br></div><div>To archive this i'm using a simple mutex and a boolean.</div><div>However it seams that i'm trying to access the render for two different threads, and the mutex isn't enough, because when interacting with the scene errors like the one below appears, and at random the program stops with a segmentation.</div><div><br></div><div>
<p style="margin:0px"><span style="color:rgb(170,0,0)">vtkOpenGLPolyDataMapper (0x1b62980): failed after UpdateShader 1 OpenGL errors detected</span></p>
<p style="margin:0px"><span style="color:rgb(170,0,0)"> 0 : (1282) Invalid operation</span></p><p style="margin:0px"><span style="color:rgb(170,0,0)"><br></span></p></div><div>I attach the code, any help is very appreciated.</div><div><br></div><div>Best regards</div></div></div><div>Antonio Fortino<span style="color:rgb(136,136,136)">-- </span></div></div></blockquote></div><span class=""><span class="m_-3080988792283645052HOEnZb"><font color="#888888"><div class="m_-3080988792283645052m_545341939116495754gmail_signature" data-smartmail="gmail_signature">______________________________<wbr>_____________<br>Andrew J. P. Maclean<br><br>______________________________<wbr>_____________</div>
</font></span></span></div></div>
</blockquote></div><br></div></div></div>
</div><br></div>