[vtkusers] Vtk renders another windows apart from the qvtkwidget

Clinton Stimpson clinton at elemtech.com
Fri Aug 24 17:47:58 EDT 2012


On Friday, August 24, 2012 07:13:07 AM 32sthide wrote:
> I have a little problem that i think it's easy so get a solution, but i've
> come to the point of trying everything and still not working. I'm sure it
> something simple, so i'm asking help as i can't figure it out on my own.
> 
> I have a qvtkwidget on the centralwidget and it has no problem.
> 
> the problem is that every time i run the program it rends another box apart
> from the interface.
> 
> here's the part of my code that matters for this issue.
> 
> // Create renderer
>   ren= vtkRenderer::New();
>     ren->AddActor(outlineActor);
>     ren->SetBackground(0.1,0.1,0.3);
> 
> // Drawing some X,Y,Z axes
>   axes= vtkCubeAxesActor2D::New();
>     //more stuff
>     ren->AddViewProp(axes);
>     ren->ResetCamera();
> 
> // Create a window for the renderer
>   renWin= vtkRenderWindow::New();
>     renWin->AddRenderer(ren);
> 
> // Set an user interface interactor for the render window
>   iren= vtkRenderWindowInteractor::New();
>     iren->SetRenderWindow(renWin);

^ there is the mistake.  vtkRenderWindowInteractor::New() is not compatible 
with QVTKWidget.
How about you let QVTKWidget make an interactor for you that works with Qt?

Clint

> 
>   style = vtkInteractorStyleTrackballCamera::New();
>     iren->SetInteractorStyle(style);
> 
> // Create a inicial camera view
> vtkCamera *inicam= ren->GetActiveCamera();
>   inicam->Zoom(1);
>   inicam->SetViewUp(0, 0, 0);
>   inicam->Azimuth(45);
>   ren->ResetCameraClippingRange();
> 
> // Start the initialization and rendering
>     renWin->Render();
> 
> // Assign the rendering window to the qvtkwidget
>   ui->qvtkWidget->SetRenderWindow(renWin);
> 
> if someone could help me I would apreciatte.
> 
> 
> 
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Vtk-renders-another-windows-apart-from-the
> -qvtkwidget-tp5715535.html Sent from the VTK - Users mailing list archive at
> Nabble.com.
> _______________________________________________
> 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://www.vtk.org/mailman/listinfo/vtkusers
-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com



More information about the vtkusers mailing list