about TkInteractor.tcl (LOD while resizing)

Sebastien Barre sbarre at claranet.fr
Sat Jan 1 20:03:50 EST 2000


Hi
(happy new year :)

I'm using the vtkTkRenderWidget to display my 3D models in Tcl/Tk GUI, and
I'm experiencing the following problems : my models are huge, and do not
display at interactive frame rate (I'm using LOD actors when moving them).
When I try to resize the whole GUI window, everything gets choppy, because
the 3D models are entirely re-rendered *while* I'm trying to resize the
window, thus preventing the user to get a fast and accurate new GUI size.
What would be nice, is that the LOD actors would be used during window
resizing.

I had a look at graphics/ExamplesTcl/TkInteractor.tcl (I'm using it), and I
guess that the "faulty" part is here :

proc BindTkRenderWidget {widget} {
  ...
    bind $widget <Expose> {Expose %W}
}

proc Expose {widget} {
    global TkInteractor_StillUpdateRate
    if {[GetWidgetVariableValue $widget InExpose] == 1} {
	return
    }
    SetWidgetVariableValue $widget InExpose 1    
    [$widget GetRenderWindow] SetDesiredUpdateRate
$TkInteractor_StillUpdateRate
    update
    [$widget GetRenderWindow] Render
    SetWidgetVariableValue $widget InExpose 0
}

Well, it means that when an Expose event is triggered by the Tk
RenderWidget, the render/window refresh/update rate is set to
non-interactive (a global variable StillUpdateRate set to 0.1) to force a
full redraw of the 3D model :( And LOD actors have therefore *no* chance to
be used.

If I change the line by replacing TkInteractor_StillUpdateRate by
TkInteractor_InteractiveUpdateRate, it works as I want, but of course it
ends with a screen displaying LOD actors when resizing is finished, which
is stupid :)

There is an event called "Configure" that might be used (bind $widget
<Configure> {Whatever %W}) : it is triggered when the window has changed
size, which is what I'm looking for. Note that the "Expose" event is
triggered too, because when resizing occurs, more of the render widget is
displayed, thus "exposed".

For the moment I was unable to find a solution : I could set a flag during
"Configure" event, and use that flag in "Expose" to set the update rate to
Interactive, and set it back to Still when "Configure" is ended, but sadly
there is no "Configure is finished" event (any trick ?). I tried to save
the widht/heigth of the widget when "Configure" is triggered, and compare
them with the current width/height in "Expose", but it does not work
either, because the event are trigerred for the same widget state (meaning
: the widget will have the same size in both events). Furthermore, for any
"Configure" there will be only one "Expose", and no more : there won't be
an additional "Expose" event that would have allowed us to notice that the
widget size has "stabilized".

Any ideas ?
Thanks for your help.






-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list