[vtkusers] JPEG OR BMPWRITER VTK Animating Help

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Apr 7 08:24:37 EDT 2004


>>>>> "Bryan" == Bryan Lee Perez <brylee at fumbo.com> writes:

    Bryan> Hi , thanks for the info, Im a newbie im a little bit lost
    Bryan> no this, i tryed to implement it on my code here is the
    Bryan> code.  the main idea is to save screenshots using my C Code
    Bryan> every time the window is redered or every time the object
    Bryan> in this case is moved froma different posicion.

My guess is you don't want to do this.  If it were possible, you would
want to connect a render event to your save fig function (posted
above) and save the figure every time the screen rendered.  I don't
know of any object that generates a render event, but I may be wrong.

You could connect your save figure to other events, like releasing the
mouse button (ending interaction) in a vtkRenderWindowInteractor

    endEvent = interactor.AddObserver( 'EndInteractionEvent', add_frame)

Then you could interact with your figure, and every time you release
the mouse button because you have a frame in your animation you want
to save, it would save the view with the add_frame function.  I still
suggest using the interpolation approach described above so your
animation is not choppy.

If you really want to try adding frames continuously interactively,
and I don't know that this is a good idea because saving the frames
will take a long time and will make your interaction choppy, you could
try connecting to the InteractionEvent

    event = interactor.AddObserver( 'InteractionEvent',  add_frame)

But your computer is normally doing hardware accelerated rendering on
your video card to get interactive refresh rates on your screen.  If
you dump to the hard disk with every frame, there's no way you'll get
smooth refresh rates, which I think you'll need for quality animation.
I may be wrong; just pontificating here.

The standard advice (eg from the VTK users guide) is the one I gave
you.  Define a set of views of your data and use interpolation to
smoothly pan/zoom/rotate your camera/data through these frames.  I
designed a GUI dialog to do this (add frame, clear frames, set number
of output frames, etc).  I rotate my scene with the mouse, click "add
frame" to save the camera info, and repeat, then click "make movie".
The code does the interpolation and starts iterating over the frames.
I go out for a long break, and 5 hours later I have a movie.

JDH



More information about the vtkusers mailing list