[vtkusers] Rendering more than one actor problem

Ken Martin ken.martin at kitware.com
Thu Mar 15 14:19:51 EDT 2018


Try yanking this line


 edges_mapper->SetResolveCoincidentTopologyPolygonOffsetParameters(1,
1);



On Thu, Mar 15, 2018 at 2:09 PM, ZACK <chihebz at hotmail.com> wrote:

> Hi Ken Martin,
>
> Thank you for your advice. I did look at new vtk example and I did not see
> that I am doing something wrong! My project is still working fine under
> vtk5.4 but not with the latest vtk version. Please take a look at the code
> below and let me know if you notice something wrong. Please note that that
> I
> have two actors, if I add only one actor to the viewprop it works fine but
> not both at the same time.!!
>
> Here's the code that is working on previous 5.0 vtk version
>
>       //rendering
>          m_prenderer = vtkopenglrenderer::New();
>         m_prenWin = vtkWin32OpenGLRenderWindow::New();
>
>          //I use append filter class to add all unstructured grids data
>          m_pUnstructuredGridModel = vtkAppendFiter::New();
>
>         //...addding data
>
>         vtkSmartPointer<vtkGeometryFilter> extract =
> vtkSmartPointer<vtkGeometryFilter>::New();
>
> extract->SetInputConnection(m_pUnstructuredGridModel->GetOutputPort());
>         extract->Modified();
>
> //creating mapper
>         InitializePolyDataMapper(m_pModelPolyDataMapper);
>
> m_pModelPolyDataMapper->SetInputConnection(extract->GetOutputPort());
>         PreparePolyDataMapper(m_pModelPolyDataMapper, pColours,
> m_CurrentMinValue,
> m_CurrentMaxValue);
>
> //creating actor
>      m_pCurrentFringeActor = vtkActor::New();
>         m_pCurrentFringeActor->SetMapper(m_pModelPolyDataMapper);
>         m_pCurrentFringeActor->SetDragable(true);
>        m_pCurrentFringeActor->VisibilityOn();
>         m_prenderer->AddViewProp(m_pCurrentFringeActor);// m_prenderer is
> vtkopenglrenderer
>
> *The piece of code above does render fine, but when I try to add the code
> below for wireframe the render windows becomes empty *
>
>         vtkSmartPointer<vtkFeatureEdges> edges_extractor =
> vtkSmartPointer<vtkFeatureEdges>::New();
>         edges_extractor->SetInputConnection(extract->GetOutputPort());
>         edges_extractor->ColoringOff();
>         edges_extractor->BoundaryEdgesOn();
>         edges_extractor->ManifoldEdgesOn();
>         edges_extractor->NonManifoldEdgesOn();
>         edges_extractor->FeatureEdgesOn();
>         edges_extractor->Modified();
>
>         vtkSmartPointer<vtkPolyDataMapper> edges_mapper =
>  vtkSmartPointer<vtkPolyDataMapper>::New();
>
>         edges_mapper->SetInputConnection(edges_
> extractor->GetOutputPort());
>         edges_mapper->SetResolveCoincidentTopologyPo
> lygonOffsetParameters(1,
> 1);
>         edges_mapper->SetResolveCoincidentTopologyToPolygonOffset();
>         edges_mapper->ScalarVisibilityOff(); // coloring edges
>
>         edges_mapper->Modified();
>
>         vtkActor*  edges_actor = vtkActor::New();
>         edges_actor->SetMapper(edges_mapper);
>         edges_actor->GetProperty()->SetDiffuseColor(0, 0, 0);
>         edges_actor->GetProperty()->SetLineWidth(m_iEdgeLineWidth);
>         edges_actor->Modified();
>        edges_actor->VisibilityOn();
>
>       //rendering
>         m_prenderer->AddViewProp(edges_actor);
>         m_prenWin->Render
>
> *Note: If I render the wireframe actor (edges_actor) by itself it does work
> fine *
>
> Thanks
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>



-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180315/7bed338d/attachment.html>


More information about the vtkusers mailing list