[vtkusers] QVTKWidget Camera vs vtkOrientationMarkerWidget

Luis Vieira luis.vieira at vektore.com
Wed Dec 28 11:48:02 EST 2016


Sankhesh,

 

I believe that the problem doesn’t regard OpenGL backend ,because I succeeded trying this example (http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes).

 

Actually, I don’t have problems with anything else using VTK 7.0 as well as was backed my OpenGL. I have been setting up the Modules within my application, as following, and worked very well. Also, I am used to with QVTKWidget. 

 

#include <vtkAutoInit.h>

VTK_MODULE_INIT(vtkRenderingOpenGL);

VTK_MODULE_INIT(vtkInteractionStyle);  

 

I don’t have problems using for example the following examples. Works smoothly.

 

vtkSmartPointer<vtkSliderRepresentation2D> sliderRep =

                     vtkSmartPointer<vtkSliderRepresentation2D>::New();

              sliderRep->SetMinimumValue(0.1);

              sliderRep->SetMaximumValue(100.0);

              sliderRep->SetValue(10.0);

              sliderRep->SetTitleText("Size");

              sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToDisplay();

              sliderRep->GetPoint1Coordinate()->SetValue(100, 100);

              sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToDisplay();

              sliderRep->GetPoint2Coordinate()->SetValue(300, 100);

 

              vtkSliderWidget *sliderWidget = vtkSliderWidget::New();

              sliderWidget->SetInteractor(myQVTKWidgetCamera->GetInteractor());

              sliderWidget->SetRepresentation(sliderRep);

              sliderWidget->SetAnimationModeToAnimate();

 

              sliderWidget->EnabledOn();

 

/*****************************************************************************/

 

vtkTransform* transform = vtkTransform::New();

              transform->Translate(1.0, 0.0, 0.0);

 

              vtkAxesActor* viewPortAxActor = vtkAxesActor::New();

              // The axes are positioned with a user transform

              viewPortAxActor->SetUserTransform(transform);

 

Ren1->AddViewProp(viewPortAxActor);

 

Ren1->ResetCamera();

 

 

 

 

Luis Vieira,

Consultant, Software Engineer

Vektore Exploration Consulting Corporation

ca.linkedin.com/in/joaoluisvieira

 <mailto:luis.vieira at vektore.com> 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 10:58 AM
To: Luis Vieira <luis.vieira at vektore.com>; Dean Inglis <inglis.dl at gmail.com>
Cc: VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] QVTKWidget Camera vs vtkOrientationMarkerWidget

 

Luis,

It seems like you were able to get past the error about interactor not being able to control the event loop using Dean’s suggestion. 

I am not sure why you’re getting OpenGL errors but one thing I noticed is that you are using the OpenGL backend. Would you be able to try the OpenGL2 backend?

Moreover, which version of Qt are you testing against?

​

 

On Wed, Dec 28, 2016 at 10:35 AM Luis Vieira <luis.vieira at vektore.com <mailto:luis.vieira at vektore.com> > wrote:

Tks Dean,

 

But still same, 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/ <http://ca.linkedin.com/in/> joaoluisvieira

luis.vieira at vektore.com <mailto:luis.vieira at vektore.com> 

 <http://www.vektore.com/> www.vektore.com

 

From: Dean Inglis [mailto:inglis.dl at gmail.com <mailto:inglis.dl at gmail.com> ] 
Sent: December 28, 2016 8:35 AM
To: Luis Vieira <luis.vieira at vektore.com <mailto:luis.vieira at vektore.com> >
Cc: VTK Users <vtkusers at vtk.org <mailto:vtkusers at vtk.org> >


Subject: Re: [vtkusers] QVTKWidget Camera vs vtkOrientationMarkerWidget

 

Hi Luis,



do not call Start() on the interactor within your Qt programs as Qt

manages its own event loop.

Dean

 

On Tue, Dec 27, 2016 at 5:48 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

luis.vieira at vektore.com <mailto: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

 

_______________________________________________
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 | Kitware <http://www.kitware.com/>  | (518) 881-4417


​

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161228/5ce15564/attachment.html>


More information about the vtkusers mailing list