"Live" redrawing in the VTK surface plot windows

122 views
Skip to first unread message

Tyler

unread,
Mar 9, 2010, 10:51:43 AM3/9/10
to discrete-geometry-viewer
Hi Shekhar,

I read about GDV in the December 2009 issue of Linux Journal [0]. I
just downloaded it and am having some fun with the surface plots. Nice
job! Thanks especially for releasing the binary package which ran just
fine on my Ubuntu Karmic machine.

I have a VTK question... is there any way to make the VTK window
perform "live" previews? I'd like it to redraw the entire surface plot
as I click-and-drag rather than simply showing the axes in white as
I'm dragging.

I didn't see any VTKRendererWindow properties that appear to control
this behavior [1]. If I had, I would have modified them in
refreshPlot() [2]

-Tyler

[0] http://www.linuxjournal.com/magazine/new-projects-fresh-labs-14
[1] http://www.vtk.org/doc/nightly/html/classvtkRenderWindow.html
[2] http://code.google.com/p/discrete-geometry-viewer/source/browse/dgv/src/DGVSurfacePlotVTK.cpp#195

Shakes

unread,
Mar 11, 2010, 10:08:24 PM3/11/10
to discrete-geometry-viewer
Hi Tyler,

Thanks. Glad u found DGV useful.

I have investigated the your question. Normally, in order to force
immediate rendering, u can call the Render() member of the window.
This could be either the RenderWindow or Renderer class, can't
remember which.

However, to rerender after/during interaction is tricky. I could not
find the necessary solution.
Following <http://www.vtk.org/pipermail/vtkusers/2005-June/
080418.html> and its reply, is not an option as VTK has changed since
that post. I couldn't find that (SetNeedsDisplay) member.

Looks like u should ask on the vtkusers list, they are very
helpful.... as long as the solution is not readily been discussed and
available on the net.

HTH
Cheers
Shakes

> [2]http://code.google.com/p/discrete-geometry-viewer/source/browse/dgv/s...

Shakes

unread,
Mar 11, 2010, 10:21:17 PM3/11/10
to discrete-geometry-viewer
Upon a second look... looks like u need to adjust parameters in the
vtkRenderWindowInteractor class. More specifically,
void vtkRenderWindowInteractor::SetDesiredUpdateRate (double)
<http://www.vtk.org/doc/release/5.4/html/
a01491.html#1a7b9baf6714b5587f0ce99a03979586>

Hopefully setting that member will do the trick.

Cheers
Shakes

Tyler

unread,
Mar 11, 2010, 11:43:40 PM3/11/10
to discrete-geometry-viewer
On Mar 11, 10:21 pm, Shakes <shake...@gmail.com> wrote:
> void vtkRenderWindowInteractor::SetDesiredUpdateRate (double)

Shakes,

As a workaround in the meantime I hacked up a script to take
sequential screen shots of DGV. You can find my results here:
http://unsyncopated.com/blog/index.php/2010/03/09/adding-a-dimension-to-your-photos/

Take care,

-Tyler

Shakes

unread,
Mar 12, 2010, 1:31:07 AM3/12/10
to discrete-geometry-viewer
Hi Tyler,

That looks great! ;)

If you wanted a movie, VTK can do it for u. I have plans to allow
taking of movies in DGV, but they are a bit further down in the
timeline.

To use VTK to do it, u set the angle of the camera programatically,
use

void FlyTo (vtkRenderer *ren, double x, double y, double z)
void FlyTo (vtkRenderer *ren, double *x)
void FlyToImage (vtkRenderer *ren, double x, double y)
void FlyToImage (vtkRenderer *ren, double *x)
virtual void SetNumberOfFlyFrames (int)
virtual int GetNumberOfFlyFrames ()

members from RenderWindowInteractor. You can also set the camera
directly.

Then use the WindowToImageFilter, then write a frame (of this filter)
into an AVI using AVIWriter. See <http://www.vtk.org/pipermail/
vtkusers/2007-May/091223.html> for more details. Here u can use Off-
screen rendering if your machine is not powerful enough to get the
necessary frame rate.

I would be very interested in any solution u find.

Cheers
Shakes

On Mar 12, 3:43 pm, Tyler <tyleroderk...@gmail.com> wrote:
> On Mar 11, 10:21 pm, Shakes <shake...@gmail.com> wrote:
>
> > void vtkRenderWindowInteractor::SetDesiredUpdateRate (double)
>
> Shakes,
>
> As a workaround in the meantime I hacked up a script to take

> sequential screen shots of DGV. You can find my results here:http://unsyncopated.com/blog/index.php/2010/03/09/adding-a-dimension-...
>
> Take care,
>
> -Tyler

Reply all
Reply to author
Forward
0 new messages