[vtkusers] Animation Conundrum
Bruno da Silva de Oliveira
bruno at esss.com.br
Fri Oct 7 11:59:42 EDT 2005
Hi Mischa,
Try to use a timer. Connect an observer in the RenderWindowInteractor
listening for the TimerEvent, and in this handler change the texture.
HTH,
Mischa Thesberg wrote:
> This is the same problem I was having before however I still cannot
> seem to fine a solution to it. I am simulating the effect of
> projecting a movie onto a cone by creating a cone object in a render
> window (with an interactor) and changing the texture (mapped using
> textureMapToPlane) of the cone about 10 times a second (in other words
> I loop through a series of sequentially named jpeg's). The problem is
> that while this animation is occuring (which is always) the interactor
> is frozen with an hourglass (or if I put the animation in a
> rudimentary thread the hourglass is gone but I still can't interact).
> How do I keep the interactor usable as I constantly change the texture
> of the cone. I think a problem with the way I tried to thread has to
> do with the shared resources between the actor changing textures and
> the interactor. If someone could give me some advice it would be much
> appreciated. If threading is in fact necessary it would be helpful to
> have a code snippet or a link to an explicit example. The pertinent
> part of my code is below (I have kept all of the commented out stuff
> just to illustrate the type of stuff I've tried:
>
> #def myCallback():
> # if renWin.GetEventPending():
> # renWin.SetAbortRender=1
>
> # Add the actors to the renderer, set the background and size
> ren.AddActor(triangulation)
> ren.SetBackground(1, 1, 1)
> #ren.AddObserver("StartEvent", myCallback)
> renWin.SetSize(350, 350)
> #renWin.FullScreenOn()
> #iren.UpdateSize(700,700)
> #iren.AddObserver("InteractionEvent", myCallback)
> iren.Initialize()
>
> #renWin.Render()
> iren.Start()
>
> for i in range(100,260):
> time.sleep(0.03)
> #iren.UnRegister(renWin)
> #iren = None
> #iren = vtk.vtkRenderWindowInteractor()
> givable = "C:/Conics/1-32-04/9-28-2005 1-32-04 PM-0%d" %
> i+".jpg"
> jpgReader.SetFileName(givable)
> atext.SetInput(jpgReader.GetOutput())
> #atext.Render(ren)
> #ren.Render()
> renWin.Render()
> #print iren.GetInitialized()
> #iren.SetRenderWindow(renWin)
> #iren.Enable()
> #iren.Initialize()
> #iren.Start()
>
>
> _______________________________________________
> 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
>
--
Bruno da Silva de Oliveira
bruno at esss.com.br
ESSS - Engineering Simulation and Scientific Software
http://www.esss.com.br
More information about the vtkusers
mailing list