[vtkusers] vtkAxesActor within VTK 7.0 and QVTKWidget
Luis Vieira
luis.vieira at vektore.com
Tue Jun 14 15:20:18 EDT 2016
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()->SetColo
r(0, 0, 0);
viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05);
viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05);
viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->SetColo
r(0, 0, 0);
viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05);
viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05);
viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->SetColo
r(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
<mailto:luis.vieira at vektore.com> luis.vieira at vektore.com
<http://www.vektore.com/> www.vektore.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160614/f7eabc8d/attachment.html>
More information about the vtkusers
mailing list