[vtkusers] 3D model and 2d Image overlay - depth issues, flickering
Miro Drahos
mdrahos at robodoc.com
Thu Nov 7 14:56:09 EST 2013
Try to keep just one camera and set the other renderer to it:
ren2->SetActiveCamera(ren->GetActiveCamera());
Also, do you really need all these
rw->SetWindowId(hWnd); * //rw is vtkWin32OpenGLRenderWindow*
rw->SetParentId(hWnd);
rw->SetDeviceContext(hDC);
rw->SetContextId(hRC);
Why not just create vtkRenderWindow and let VTK deal with the device/OS
specific-issues?
Cheers,
Miro
On 11/06/2013 10:07 PM, manikandtan.ck wrote:
> rw->SetWindowId(hWnd); * //rw is vtkWin32OpenGLRenderWindow*
> rw->SetParentId(hWnd);
> rw->SetDeviceContext(hDC);
> rw->SetContextId(hRC);
> rw->SetSize(rect.Width(), rect.Height());
> ren->SetLayer(0); *//ren and ren2 are the renderers*
> ren->InteractiveOn();
> ren2->SetLayer(1);
> ren2->InteractiveOff();
> rw->SetNumberOfLayers(2);
> rw->AddRenderer(ren);
> rw->AddRenderer(ren2);
> iren->SetRenderWindow(rw); *//iren is the render window interactor*
>
> *////vtkvolume and vtkImageActor are created here*
>
> ren->RemoveAllViewProps();
> ren2->RemoveAllViewProps();
>
> ren->AddActor(volume); *///volume is a vtkVolume*
> ren2->AddActor(imageActorax); */// imageActorax is a vtkImageActor*
>
> rw->Render();
>
> camera = ren->GetActiveCamera();
>
> camera->SetFocalPoint(c[0], c[1], c[2]); *///c[3] is center of volume*
> camera->SetPosition(c[0] + 500, c[1], c[2]);
> camera->Azimuth(90);
>
> camera2 = ren2->GetActiveCamera();
>
> camera2->SetFocalPoint(c[0], c[1], c[2]);
> camera2->SetPosition(c[0] + 500, c[1], c[2]);
> camera2->Azimuth(90);
>
> iren->EnableRenderOn();
> iren->SetInteractorStyle(style); *///style is
> vtkInteractorStyleTrackballCamera*
> style->EnabledOn();
> style->On();
>
> rw->GlobalWarningDisplayOff();
> ren->GlobalWarningDisplayOff();
> iren->GlobalWarningDisplayOff();
>
> rw->Render();
>
> iren->Initialize();
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/3D-model-and-2d-Image-overlay-depth-issues-flickering-tp5724298p5724343.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