<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 1/13/2015 4:36 PM, David Gobbi
wrote:<br>
</div>
<blockquote
cite="mid:CANwS1=GVT1gd0sAu85A6sUw2Nt6eJs2jRHat0+y4vLwRDAFG0w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">
<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>
</div>
</div>
</blockquote>
I see. Currently I have a very simple polling timer, checking for an
integer being set to 1 or 0. If the integer is set, I do a render.
Works fine. Don't need a mutex for that I assume. <br>
<br>
<blockquote
cite="mid:CANwS1=GVT1gd0sAu85A6sUw2Nt6eJs2jRHat0+y4vLwRDAFG0w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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>
</div>
</div>
</div>
</blockquote>
I'm not familiar with Qt slots, and I have not tried the polling in
a ms windows application yet. But I guess one can post a custom user
message, that is intercepted in the apps message loop (which is
polling), and handle it there. Would just be a call to render();<br>
<br>
Obviously I take your word for becoming a fan of polling! Thanks. <br>
<br>
<blockquote
cite="mid:CANwS1=GVT1gd0sAu85A6sUw2Nt6eJs2jRHat0+y4vLwRDAFG0w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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>
</div>
</div>
</blockquote>
I assume it is so that the renderInteractive() call creates the
"application loop", in a console application, since there is only
one thread?<br>
<br>
tk<br>
<br>
<br>
</body>
</html>