[vtkusers] [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Thu Jun 16 09:54:17 EDT 2016


Hi Luis,

I don't see anything obvious but I noticed that you are initializing
vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the OpenGL2
backend to find out whether the issue is specific to the old backend.

Sankhesh



On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira <luis.vieira at vektore.com>
wrote:

> Hello everyone,
>
>
>
> I had migrated my VTK platform from 6.1 to 7.0. I had noticed some
> changes, and one of those is giving me a hard work to do that is to render
> vtkSmartPointer<vtkAxesActor>::New() within QVTWidget. Previously, was
> easily,  with VTK 6.1. Now, I am trying that and I got the Cone
> working/rendering well and its interactions. However, I haven't gotten
> absolutely nothing on my viewport from my vtkAxesActor even been shown .
> Following my code (C++), regarding that this works outside QVTWidget
> viewport.
>
>
>
> I appreciate any ideas and help.
>
> ……………………
>
> #include "vtkRenderWindow.h"
>
> #include "vtkRenderer.h"
>
> #include "vtkRenderWindowInteractor.h"
>
> #include "vtkEventQtSlotConnect.h"
>
> #include "vtkCommand.h"
>
> #include "vtkConeSource.h"
>
> #include "vtkSphereSource.h"
>
> #include "vtkPolyDataMapper.h"
>
> #include "vtkActor.h"
>
> #include "vtkActorCollection.h"
>
> #include "vtkCaptionActor2D.h"
>
> #include "vtkTextActor.h"
>
> #include "vtkTextProperty.h"
>
> #include "vtkActor2D.h"
>
> #include "vtkAxesActor.h"
>
> #include "vtkOrientationMarkerWidget.h"
>
> #include "vtkInteractorStyle.h"
>
> #include "vtkTDxInteractorStyleCamera.h"
>
> #include "vtkTDxInteractorStyleSettings.h"
>
> #include "vtkInteractorStyleRubberBandPick.h"
>
> #include "vtkInteractorStyleTrackballCamera.h"
>
> #include "vtkInteractorStyleTrackball.h"
>
> #include "QVTKInteractorAdapter.h"
>
> #include "QVTKInteractor.h"
>
> #include "QVTKApplication.h"
>
> …….
>
> .
>
> .
>
> .
>
> #include <vtkAutoInit.h>
>
> VTK_MODULE_INIT(vtkRenderingOpenGL);
>
> VTK_MODULE_INIT(vtkInteractionStyle);
>
> .
>
> .
>
> .
>
>
>
> Mainwindow.cpp
>
>
>
> Void procedure()
>
> {
>
> vtkRenderWindow* renwin = vtkRenderWindow::New();
>
>               renwin->StereoCapableWindowOn();
>
>
>
>               // Activate 3DConnexion device only on the left render
> window.
>
>               // QVTKWidget
>
>               mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort.
>
>
>
>               mainViewPort->SetRenderWindow(renwin);
>
>               renwin->Delete();
>
>
>
>               const double angleSensitivity = 0.02;
>
>               const double translationSensitivity = 0.001;
>
>
>
>               QVTKInteractor *iren = mainViewPort->GetInteractor();
>
>               vtkInteractorStyle *s =
>
>                       static_cast<vtkInteractorStyle *>(iren->
> GetInteractorStyle());
>
>               vtkTDxInteractorStyleCamera *t =
>
>                       static_cast<vtkTDxInteractorStyleCamera *>(s->
> GetTDxStyle());
>
>
>
>               t->GetSettings()->SetAngleSensitivity(angleSensitivity);
>
>               t->GetSettings()->SetTranslationXSensitivity(
> translationSensitivity);
>
>               t->GetSettings()->SetTranslationYSensitivity(
> translationSensitivity);
>
>               t->GetSettings()->SetTranslationZSensitivity(
> translationSensitivity);
>
>
>
>
>
>
>
>               // add a renderer
>
>               Ren1 = vtkRenderer::New();
>
>               mainViewPort->GetRenderWindow()->AddRenderer(Ren1);
>
>
>
>               vtkConeSource* cone = vtkConeSource::New();
>
>               vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
>
>               mapper->SetInputConnection(cone->GetOutputPort());
>
>               vtkActor* actor = vtkActor::New();
>
>               actor->SetMapper(mapper);
>
>               Ren1->AddViewProp(actor);
>
>               actor->Delete();
>
>               mapper->Delete();
>
>               cone->Delete();
>
>
>
>
>
>
>
>               mainViewPort->GetRenderWindow()->Render();
>
>
>
> viewPortAxActor = vtkSmartPointer<vtkAxesActor>::New();
>
> viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->
> SetColor(0, 0, 0);
>
> viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05);
>
> viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05);
>
> viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->
> SetColor(0, 0, 0);
>
> viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05);
>
> viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05);
>
> viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->
> SetColor(0, 0, 0);
>
> viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05);
>
> viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05);
>
>
>
> viewPortOMWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
>
> viewPortOMWidget->SetOrientationMarker(viewPortAxActor);
>
> viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3);
>
> viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor());
>
>
>
> .
>
> .
>
> .
>
> .....
>
> }
>
>
>
> Any ideas?
>
>
>
> Thank you very much.
>
>
>
> *Luis Vieira*, Toronto
>
> Consultant, Software Engineer
>
> Vektore Exploration Consulting Corporation
>
> luis.vieira at vektore.com
>
> www.vektore.com
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160616/a66a1c3e/attachment.html>


More information about the vtkusers mailing list