<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 13, 2015 at 5:01 PM, Totte Karlsson <span dir="ltr"><<a href="mailto:totte@dunescientific.com" target="_blank">totte@dunescientific.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
The update of internal data in the subject may be performed in a thread and I have now come across the fact that one can't call render() from such. Instead, one need to communicate that a render() is needed trough some data variable. This can be done but setting up a timer that checks every so often, and if the variable is 'set', do a render in the timer callback. But I never been a big fan of that kind of pulling. So I wonder if there is another, more direct way?<br></blockquote><div><br></div><div>The rendering in VTK must be done from the main application thread (i.e. the thread that runs the application's main event loop), and in an application, polling is an excellent way for the main loop to check if any other threads require attention.  So my advice is that you become a fan of polling.  In this case, it's the right way forward.</div><div><br></div><div>You could, instead, have your thread ask the operating system to send your application some kind of notification that the main loop could respond to, but that would probably be less efficient than polling (and it would be platform-specific).  Or, in Qt, you could take advantage of an asynchronous signal-slot connection and let Qt take care of the details (Qt would either do polling internally, or would use an OS-level notification, I'm not sure which).</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have noticed when I execute renderInteractive(), that vtk objects are indeed updated from their sources every time the mouse interactively generate a 'render' somewhere. Not sure how that works. Is it possible to tie in there somewhere?<br></blockquote><div><br></div><div>The mouse events are caught by the application's main loop, and the main application thread responds to these events (and performs the render at the end).  So you won't find any insight there about how to do things in a multi-threaded fashion.</div><div><br></div><div> - David</div></div></div></div>