[vtkusers] Animation Conundrum

Mischa Thesberg mejthesb at swri.ca
Fri Oct 7 11:51:49 EDT 2005


    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()





More information about the vtkusers mailing list