[vtkusers] Axes marker not working as expected

Bill Lorensen bill.lorensen at gmail.com
Thu Dec 11 07:46:59 EST 2014


This example puts the marker in its own viewport.
http://www.itk.org/Wiki/VTK/Examples/Cxx/Widgets/OrientationMarkerWidget


On Thu, Dec 11, 2014 at 12:07 AM, Júlio Hoffimann
<julio.hoffimann at gmail.com> wrote:
> Dear all,
>
> I'm trying to create a viewer widget with a QVTKWidget inside. For some
> reason the axes marker is not fixed in the bottom left of the scene. It
> moves together with the other objects (screenshot attached).
>
> The code for the constructor is straightforward:
>
> VTKViewer::VTKViewer(QWidget *parent) : QWidget(parent)
> {
>     QVTKWidget *qvtkwidget = new QVTKWidget;
>
>     auto axes = vtkSmartPointer<vtkAxesActor>::New();
>     axes->SetXAxisLabelText("x");
>     axes->SetYAxisLabelText("y");
>     axes->SetZAxisLabelText("z");
>
>     auto orientationMarker =
> vtkSmartPointer<vtkOrientationMarkerWidget>::New();
>     orientationMarker->SetInteractor(qvtkwidget->GetInteractor());
>     orientationMarker->SetOrientationMarker(axes);
>     orientationMarker->SetEnabled(1);
>
>     // sphere
>     auto sphereSource = vtkSmartPointer<vtkSphereSource>::New();
>     sphereSource->SetCenter(8, 8, 8);
>     sphereSource->SetRadius(5.0);
>     auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
>     mapper->SetInputConnection(sphereSource->GetOutputPort());
>     auto actor = vtkSmartPointer<vtkActor>::New();
>     actor->SetMapper(mapper);
>
>     auto renderer = vtkSmartPointer<vtkRenderer>::New();
>     renderer->AddActor(axes);
>     renderer->AddActor(actor);
>
>     vtkRenderWindow *renderWindow = qvtkwidget->GetRenderWindow();
>     renderWindow->AddRenderer(renderer);
> }
>
> Why the orientation marker is not behaving as expected? Does the order of
> object creation in VTK matter (renderer, renderwindow, actors)? What should
> be the lifetime for each object in the code snippet above?
>
> I appreciate any help,
> Júlio.
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list