<div dir="ltr"><div>Try changing from polydatamapper to datasetmapper, or pretty much equivalently put a datasetsurfacefilter (named "geometryfilter" in on of the example) in between the reader and the polydatamapper.</div><div><br></div><div>In either case what happens is that the unstructured grid (potentially containing volumetric elements eg tetrahedra) gets converted to a polydata (containing only locally 2D elements eg triangles) which can be drawn by GL.</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div>
<br><div class="gmail_quote">On Thu, Mar 3, 2016 at 9:50 AM, Vladi Mitover <span dir="ltr"><<a href="mailto:vladi88@gmx.de" target="_blank">vladi88@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12px"><div>
<div>Hello everyone,</div>
<div> </div>
<div>I use the VTK version 6.3.0-55.5.</div>
<div> </div>
<div>I am trying to do the following: read a "legacy" ASCII VTK file and that file represents an example of an unstructured grid in 3D, as done in the following VTK/Cxx-examples:</div>
<div>1)To read "legacy" ASCII VTK file: <br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/GenericDataObjectReader" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/GenericDataObjectReader</a><br>
I have included vtkGenericDataObjectReader.h, vtkPolyData.h, string</div>
<div>2)To make a 3DPlot:<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadPLOT3D" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadPLOT3D</a><br>
Here I change the vtkStructuredGridGeometryFilter.h to vtkUnstructuredGridReader.h</div>
<div>3)To read unstructured Grid:<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadUnstructuredGrid" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadUnstructuredGrid</a><br>
</div>
<div>When I build it, it looks as if everything was okay but when I play it, in the opening window nothing is to see.</div>
<div>Below is my code:</div>
<div><br>
#include <vtkVersion.h><br>
#include <vtkPolyData.h><br>
#if VTK_MAJOR_VERSION <= 5<br>
#include <vtkPLOT3DReader.h><br>
#else<br>
#include <vtkMultiBlockPLOT3DReader.h><br>
#include <vtkMultiBlockDataSet.h><br>
#endif<br>
#include <vtkSmartPointer.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h></div>
<div>//===============================================<br>
//Header from example GenericDataObjectReader.cxx<br>
//===============================================<br>
#include <vtkGenericDataObjectReader.h><br>
#include <vtkPolyData.h><br>
#include <string></div>
<div>//=============================================<br>
//Header from example ReadUnstructuredGrid.cxx<br>
//=============================================<br>
#include <vtkUnstructuredGridReader.h><br>
#include <vtkDataSetMapper.h></div>
<div> </div>
<div>using namespace std;</div>
<div>int main (int argc, char *argv[])<br>
{<br>
<br>
//Ensure a filename was specified<br>
if(argc != 2)<br>
{<br>
std::cerr << "Usage: " << argv[0] << " InputFilename(.vtk)" << endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
//Get the filename from the command line<br>
std::string inputFilename = argv[1];<br>
<br>
//Read all the data from the file<br>
vtkSmartPointer<vtkUnstructuredGridReader> reader =<br>
vtkSmartPointer<vtkUnstructuredGridReader>::New();<br>
reader->SetFileName(inputFilename.c_str());<br>
reader->Update(); <br>
<br>
//Visualize<br>
vtkSmartPointer<vtkPolyDataMapper> mapper =<br>
vtkSmartPointer<vtkPolyDataMapper>::New();<br>
// mapper->SetInputConnection(geometryFilter->GetOutputPort());<br>
mapper->SetInputConnection(reader->GetOutputPort());<br>
mapper->ScalarVisibilityOff();<br>
<br>
vtkSmartPointer<vtkActor> actor =<br>
vtkSmartPointer<vtkActor>::New();<br>
actor->SetMapper(mapper);<br>
<br>
//Create a renderer, render window, and interactor<br>
vtkSmartPointer<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::New();<br>
vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
<br>
renderer->AddActor(actor);<br>
renderer->SetBackground(.3, .6, .3); // Background color green<br>
<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
return EXIT_SUCCESS;<br>
}</div>
<div> </div>
<div> </div>
<div> </div>
<div>What is wrong? Can anyone help?</div>
<div> </div>
<div>Thank you very much in advance.</div>
<div> </div>
<div>And here the file</div>
<div> </div>
</div></div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank" rel="noreferrer">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank" rel="noreferrer">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" rel="noreferrer">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank" rel="noreferrer">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank" rel="noreferrer">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>