[vtkusers] Vtk renders another windows apart from the qvtkwidget

Alex Malyushytskyy alexmalvtk at gmail.com
Fri Aug 24 17:35:41 EDT 2012


This example is far from completion.
You mentioned QVTKWidget.
So I assume you have one and want to use renderer window it created ,

so do not create another one and replace

>
> // Create a window for the renderer
>   renWin= vtkRenderWindow::New();
>     renWin->AddRenderer(ren);
>
with ( assuming this points to QVTKWidget subclass instance)
     this->GetRenderWindow()->AddRenderer(ren);

Regards,
    Alex

On Fri, Aug 24, 2012 at 7:13 AM, 32sthide <32sthide at gmail.com> 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);
>
>   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



More information about the vtkusers mailing list