[vtkusers] vtkPlaybackWidget doesn't "play"

David Cole david.cole at kitware.com
Tue Dec 2 11:18:39 EST 2008


And be careful with the threading stuff. You have to call
vtkRenderWindow::Render from the main GUI thread. Actually, all VTK method
calls should be synchronized to a single thread (which always means the main
GUI thread if you ever have any vtkRenderWindow objects...) You won't be
happy if you try to call VTK methods from another thread. :-)

On Tue, Dec 2, 2008 at 11:15 AM, David Cole <david.cole at kitware.com> wrote:

> 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.
> Call vtkRenderWindow::Render, not vtkRenderer::Render...
>
> HTH,
> David
>
>
> On Tue, Dec 2, 2008 at 11:10 AM, Gerrick Bivins <
> gbivins at objectreservoir.com> wrote:
>
>>  Hi David,
>>
>> I've tried calling Render via
>> vtkPlaybackRepresenation::GetRenderer()->Render() but that had no effect.
>>
>>
>>
>> I've subclassed vtkPlaybackRepresentation and overridden Play as follows:
>>
>>
>>
>>      virtual void Play()
>>
>>      {
>>
>>         _playing = true;
>>
>>         //this->_playThread.join();
>>
>>         this->PlayThread();
>>
>>
>>
>>      }
>>
>>
>>
>> With PlayThread() as follows (which I'd like eventually move functionality
>> into a thread so I can pause it):
>>
>>       void PlayThread()
>>
>>       {
>>
>>         while(_currentFrame < NumberOfFrames && _playing)
>>
>>         {
>>
>>
>> //this->_pbw->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
>>
>>               std::cout<<_currentFrame<<std::endl;
>>
>>               this->UpdateCurrentFrame(1);
>>
>>               this->GetRenderer()->Render();
>>
>>         }
>>
>>       }
>>
>>
>>
>> UpdateCurrentFrame calculates the next frame depending on direction and
>> triggers the pipeline update.
>>
>>
>>
>> Gerrick
>>
>>
>>
>> *From:* David Cole [mailto:david.cole at kitware.com]
>> *Sent:* Tuesday, December 02, 2008 9:48 AM
>> *To:* Gerrick Bivins
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkPlaybackWidget doesn't "play"
>>
>>
>>
>> Are you calling Render from your play callback after each step of the
>> animation...?
>>
>>
>>
>> On Tue, Dec 2, 2008 at 10:33 AM, Gerrick Bivins <
>> gbivins at objectreservoir.com> wrote:
>>
>>
>> Hello,
>> I'm trying to use the vtkPlaybackWidget to control an animation sequence.
>> All the actions work as expected except for the "play" button.  I've
>> overridden the Play callback function to loop over my animation and update
>> for each step but the render window is only updated at the end of
>> sequence.
>> Using the "Forward" and "Backward" step buttons work as expected. Does
>> anyone have any suggestions on how to get the render to update using the
>> "Play" button?
>> Thanks in advance,
>> Gerrick
>> --
>> View this message in context:
>> http://www.nabble.com/vtkPlaybackWidget-doesn%27t-%22play%22-tp20794191p20794191.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081202/7d323c54/attachment.htm>


More information about the vtkusers mailing list