You need to call vtkRenderWindow::Render after each change to force a render before the animation continues... Otherwise, there will just be a pending paint message waiting to be processed when your animation is over and you are again allowing the message loop to process paint messages.<div>
<br></div><div>Call vtkRenderWindow::Render, not vtkRenderer::Render...</div><div><br></div><div>HTH,</div><div>David</div><div><br><br><div class="gmail_quote">On Tue, Dec 2, 2008 at 11:10 AM, Gerrick Bivins <span dir="ltr"><<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p><span style="font-size:11.0pt;color:#1F497D">Hi David,</span></p>
<p><span style="font-size:11.0pt;color:#1F497D">I've tried calling Render via vtkPlaybackRepresenation::GetRenderer()->Render()
but that had no effect.</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">I've subclassed vtkPlaybackRepresentation and overridden Play
as follows:</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New";color:blue"> virtual</span><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:blue">void</span>
Play()</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> {</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> _playing = <span style="color:blue">true</span>;</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:green">//this->_playThread.join();</span></span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:blue">this</span>->PlayThread();</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New"">
}</span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">With PlayThread() as follows (which I'd like eventually move
functionality into a thread so I can pause it):</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New";color:blue"> void</span><span style="font-size:10.0pt;font-family:"Courier New""> PlayThread()</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> {</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:blue">while</span>(_currentFrame < NumberOfFrames &&
_playing)</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> {</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:green">//this->_pbw->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);</span></span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
std::cout<<_currentFrame<<std::endl;</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:blue">this</span>->UpdateCurrentFrame(1);</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:blue">this</span>->GetRenderer()->Render();</span></p>
<p style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> }</span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New""> }</span><span style="font-size:11.0pt;color:#1F497D"></span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">UpdateCurrentFrame calculates the next frame depending on
direction and triggers the pipeline update.</span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New"">Gerrick</span><span style="font-size:11.0pt;color:#1F497D"></span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> David Cole
[mailto:<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>] <br>
<b>Sent:</b> Tuesday, December 02, 2008 9:48 AM<br>
<b>To:</b> Gerrick Bivins<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] vtkPlaybackWidget doesn't "play"</span></p>
</div><div><div></div><div class="Wj3C7c">
<p> </p>
<p>Are you calling Render from your play callback after each
step of the animation...?</p>
<div>
<p style="margin-bottom:12.0pt"> </p>
<div>
<p>On Tue, Dec 2, 2008 at 10:33 AM, Gerrick Bivins <<a href="mailto:gbivins@objectreservoir.com" target="_blank">gbivins@objectreservoir.com</a>>
wrote:</p>
<p><br>
Hello,<br>
I'm trying to use the vtkPlaybackWidget to control an animation sequence.<br>
All the actions work as expected except for the "play" button.
I've<br>
overridden the Play callback function to loop over my animation and update<br>
for each step but the render window is only updated at the end of sequence.<br>
Using the "Forward" and "Backward" step buttons work as
expected. Does<br>
anyone have any suggestions on how to get the render to update using the<br>
"Play" button?<br>
Thanks in advance,<br>
Gerrick<br>
--<br>
View this message in context: <a href="http://www.nabble.com/vtkPlaybackWidget-doesn%27t-%22play%22-tp20794191p20794191.html" target="_blank">http://www.nabble.com/vtkPlaybackWidget-doesn%27t-%22play%22-tp20794191p20794191.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><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></p>
</div>
<p> </p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>