[vtkusers] QVTKWidget Camera vs vtkOrientationMarkerWidget
Luis Vieira
luis.vieira at vektore.com
Wed Dec 28 10:27:51 EST 2016
Tks Sankhesh,
But didn’t work: Following Exceptions and snapshot
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLRenderer.cxx, line 126
vtkOpenGLRenderer (0000004A68B268A0): failed ater ClearLights 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLRenderer.cxx, line 1202
vtkOpenGLRenderer (0000004A68B268A0): failed after Clear 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLCamera.cxx, line 176
vtkOpenGLCamera (0000004A67EA1870): failed after Render 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLLight.cxx, line 118
vtkOpenGLLight (0000004A68A31190): failed after Render 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLRenderer.cxx, line 192
vtkOpenGLRenderer (0000004A68B268A0): failed after UpdateLights 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
ERROR: In C:\VTK\VTK-7.0.0\Rendering\OpenGL\vtkOpenGLRenderer.cxx, line 282
vtkOpenGLRenderer (0000004A68B268A0): failed after DeviceRender 16 OpenGL errors detected
0 : (1282) Invalid operation
1 : (1282) Invalid operation
2 : (1282) Invalid operation
3 : (1282) Invalid operation
4 : (1282) Invalid operation
5 : (1282) Invalid operation
6 : (1282) Invalid operation
7 : (1282) Invalid operation
8 : (1282) Invalid operation
9 : (1282) Invalid operation
10 : (1282) Invalid operation
11 : (1282) Invalid operation
12 : (1282) Invalid operation
13 : (1282) Invalid operation
14 : (1282) Invalid operation
15 : (1282) Invalid operation
// create a window to make it stereo capable and give it to QVTKWidget
// create a window to make it stereo capable and give it to QVTKWidget
vtkRenderWindow* renwin = vtkRenderWindow::New();
renwin->StereoCapableWindowOn();
// Activate 3DConnexion device only on the left render window.
mainViewPort->SetUseTDx(true);
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);
vtkAxesActor* viewPortAxActor = vtkAxesActor::New();
// The axes are positioned with a user transform
//viewPortAxActor->SetUserTransform(transform);
viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(1, 1, 1);
viewPortAxActor->SetXAxisLabelText("E");
viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05);
viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05);
viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(1, 1, 1);
viewPortAxActor->SetYAxisLabelText("N");
viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05);
viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05);
viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(1, 1, 1);
viewPortAxActor->SetZAxisLabelText("Up");
viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05);
viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05);
vtkSmartPointer<vtkOrientationMarkerWidget> viewPortOMWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
viewPortOMWidget->SetOrientationMarker(viewPortAxActor);
viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor());
viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3);
viewPortOMWidget->SetEnabled(1);
viewPortOMWidget->InteractiveOn();
Ren1->ResetCamera();
Ren1->Render();
//mainViewPort->GetRenderWindow()->GetInteractor()->Start();
Luis Vieira,
Consultant, Software Engineer
Vektore Exploration Consulting Corporation
ca.linkedin.com/in/joaoluisvieira
luis.vieira at vektore.com <mailto:luis.vieira at vektore.com>
<http://www.vektore.com/> www.vektore.com
From: Sankhesh Jhaveri [mailto:sankhesh.jhaveri at kitware.com]
Sent: December 28, 2016 8:16 AM
To: Luis Vieira <luis.vieira at vektore.com>; VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] QVTKWidget Camera vs vtkOrientationMarkerWidget
Hi Luis,
Try setting the interactor from the widget:
myWidget ->SetInteractor(myQVTKWidgetCAmera->GetInteractor());
On Tue, Dec 27, 2016, 5:56 PM Luis Vieira <luis.vieira at vektore.com <mailto:luis.vieira at vektore.com> > wrote:
Hello vtkusers,
Anybody knows how to use vtkOrientationMarkerWidget with QVTKWidget interactor? I have been trying to implement the VTK example (http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes) and it worked smoothly. However, within my QVTKWidget Camera, and I caught the following exception:
ERROR: In C:\VTK\VTK-7.0.0\GUISupport\Qt\QVTKInteractor.cxx, line 147
QVTKInteractor (000000F46583D670): QVTKInteractor cannot control the event loop.
Following my vtkOrientationMarkerWidget snapshot:
vtkRenderWindow* renwin = vtkRenderWindow::New();
myQVTKWidgetCAmera->SetRenderWindow(renwin);
Ren1 = vtkRenderer::New();
myQVTKWidgetCAmera->GetRenderWindow()->AddRenderer(Ren1);
vtkAxesActor* myAxActor = vtkAxesActor::New();
vtkSmartPointer<vtkOrientationMarkerWidget> myWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
myWidget ->SetOrientationMarker(myAxActor);
myWidget ->SetInteractor(myQVTKWidgetCAmera->GetRenderWindow()->GetInteractor());
myWidget ->SetViewport(0.7, 0.0, 1.00, 0.3);
myWidget ->SetEnabled(1);
myWidget ->InteractiveOn();
Ren1->ResetCamera();
Ren1->Render();
myQVTKWidgetCAmera->GetRenderWindow()->GetInteractor()->Start();
Thank you very much for any help,
Luis Vieira,
Consultant, Software Engineer
Vektore Exploration Consulting Corporation
<http://ca.linkedin.com/in/> ca.linkedin.com/in/joaoluisvieira
<mailto:luis.vieira at vektore.com> luis.vieira at vektore.com
<http://www.vektore.com/> www.vektore.com
_______________________________________________
Powered by www.kitware.com <http://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
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri
Sr. Research & Development Engineer | <http://www.kitware.com/> Kitware | (518) 881-4417
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161228/6313aaad/attachment.html>
More information about the vtkusers
mailing list