[vtkusers] integrate a vtkOrientationMarkerWidget into aQVtkWidget

HamidG listboss at gmail.com
Mon Nov 28 22:20:55 EST 2011


John Platt-3 wrote
> 
> Hi,
> 
> This is the essence of what I do in a QVTKWidget derived class ...
> 
>     m_vtkRenderer = vtkRenderer::New();
>     vtkRenderWindow* renWin = GetRenderWindow();
>     renWin->AddRenderer( m_vtkRenderer );
> 
>     m_vtkAxesWidget = vtkOrientationMarkerWidget::New();
>     
> 

Thanks John, this helped. My problem was that I was using vtkSmartPointer
for vtkOrientationMarkerWidget
and it was going out of scope (I shouldn't just copy and paste Example code
to my code!
well me and the OP made the same mistake by combining the two examples we
found for axes display and qtvtkwidget).

I made _vtkAxesWidget a class member.

     _vtkAxesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
    vtkRenderWindowInteractor *iren =
ren1->GetRenderWindow()->GetInteractor();
    _vtkAxesWidget->SetDefaultRenderer(ren1);
    _vtkAxesWidget->SetInteractor(iren);

    _vtkAxes = vtkSmartPointer<vtkAxesActor>::New();
    _vtkAxesWidget->SetOrientationMarker(_vtkAxes);

    _vtkAxesWidget->SetOutlineColor( 0.9300, 0.5700, 0.1300 );
    _vtkAxesWidget->SetViewport( 0.0, 0.0, 0.34, 0.34 );
    _vtkAxesWidget->SetEnabled(1);
    _vtkAxesWidget->InteractiveOn();

--
View this message in context: http://vtk.1045678.n5.nabble.com/integrate-a-vtkOrientationMarkerWidget-into-a-QVtkWidget-tp2843764p5031014.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list