[vtkusers] vtkScalarBarWidget significantly slows down mouse interaction

da remywendy at gmail.com
Wed Sep 23 18:56:24 EDT 2009


I don't know about the slow down that you are experiencing; however I
notcided in your implementation with vtkScalarBarWidget you never call the
On() method, instead adding the actor directly to the renderer.

 If this is all you need (the actor), then you can just use
vtkScalarBarActor without the associated vtkScalarBarWidget. The widget is
for use with user interactions: repositioning or resizing the scalar bar.

As for the slowing, maybe try 1) use AddActor2D. 2) deep copy (or shallow,
whichever one was the one that doesn't copy the pipeline) your lookuptable.
no idea if any of these would be helpful though.

On Fri, Sep 18, 2009 at 1:36 PM, Alex Malyushytskyy <alexmalvtk at gmail.com>wrote:

> System info: VTK-5.4.2, win32, Windows 64BIT, MSVC 2005 sp2, QT 4.4.3
>
> I have 3D poly data based model which I need to display in color based
> on some nodal array values.
> Also I wanted to display vtkScalarBarWidget  to present color
> distribution by value.
>
> Unfortunately I found that it significantly slows down mouse interaction.
> It does not even depend on the size of the model.
> Effect stays the same within range I tested - from 3 to 150k triangles.
>
>
> If vtkScalarBarWidget  is not present or corresponded
> vtkScalarBarActor set hidden with GetScalarBarActor()->SetVisibility(
> false ), interaction is smooth. Small mouse movement correspond to
> small model rotation.
>
> When visibility is set to true with
> GetScalarBarActor()->SetVisibility( true ), there is about 1-2 sec
> delay between mouse movement and model rotation, which leads to step
> like model rotation.
>
> I don't think this is normal. In my case colormap has 64 colors and no
> array neither colormap is changing during rotation. Rendering Scalar
> bar should not take that much time either, especially counting that no
> information related to it changed.
> re- rendering 150k triangles after rotation is done faster than
> scalarbar with 64 labels and 64 colored triangle in 2D space.
>
> So I assume I either use it incorrectly or there is a problem with
> .vtkScalarBarActor or vtkScalarBarWidget.
>
> Am I missing something obvious?
> Am I using it incorrectly?
> Is there a way to fix the problem?
> Is there an actor which  hides scalarbar when interaction begin  (like
> LODActor for data)?
>
>
> Best regards,
>          Alex
>
>
> Below there is a code related to scalarbar creation:
>
> /////////////////////
>        ren = vtkSmartPointer<vtkRenderer>::New();
>        this->GetRenderWindow()->AddRenderer( ren );
>
>        vtkRenderWindowInteractor * iact =
> GetRenderWindow()->GetInteractor();
>
>
> //              create a colorbar
> #if !defined USE_NO_COLOR_BAR
>        this->scalarBarWidget = vtkSmartPointer<vtkScalarBarWidget>::New();
>        this->scalarBarWidget->SetInteractor( iact );
>        this->scalarBarWidget->GetScalarBarActor()->SetTitle("Data Range");
>        this->scalarBarWidget->GetScalarBarActor()->SetLookupTable(
> compositePolyDatamapperMapper->GetLookupTable() );
>        this->scalarBarWidget->GetScalarBarActor()->PickableOn();
>        this->scalarBarWidget->GetScalarBarActor()->SetDragable( 1 );
>        this->scalarBarWidget->SetRepositionable( 1 );
>        this->scalarBarWidget->SetSelectable( 0 );
>
>        this->scalarBarWidget->GetScalarBarActor()->SetNumberOfLabels( 64 );
>        this->scalarBarWidget->GetScalarBarActor()->GetPositionCoordinate(
> )->SetCoordinateSystemToNormalizedViewport();
>
>        this->scalarBarWidget->GetScalarBarActor()->GetPositionCoordinate(
> )->SetValue( 0.91, 0.02);
>        this->scalarBarWidget->GetScalarBarActor()->SetNumberOfLabels( 64 );
>        this->scalarBarWidget->GetScalarBarActor()->SetWidth( 0.08 );
>        this->scalarBarWidget->GetScalarBarActor()->SetHeight( 0.96 );
>
>        this->scalarBarWidget->GetScalarBarActor()->PickableOff();
>        this->scalarBarWidget->GetScalarBarActor()->SetLabelFormat("%.5g");
> //      this->scalarBarWidget->GetScalarBarActor()->SetVisibility( false );
>
>        this->ren->AddActor( this->scalarBarWidget->GetScalarBarActor() );
> #endif
> /////////////////////
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090923/b7e2d259/attachment.htm>


More information about the vtkusers mailing list