[vtkusers] vtkScalarBarWidget significantly slows down mouse interaction
Alex Malyushytskyy
alexmalvtk at gmail.com
Fri Sep 18 16:36:49 EDT 2009
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
/////////////////////
More information about the vtkusers
mailing list