[vtkusers] Rendering more than one actor problem
ZACK
chihebz at hotmail.com
Thu Mar 15 14:09:38 EDT 2018
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->SetResolveCoincidentTopologyPolygonOffsetParameters(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
More information about the vtkusers
mailing list