Q: How to use a self-built geometry as a source for glyph3d?

Mirco Müller mirco at pool.informatik.rwth-aachen.de
Thu Nov 18 07:20:37 EST 1999


Greetings vtk-gurus!

    I want to use a special geometry as a source object for a glypd3d.
But nothing gets rendered by vtk. Only prebuild source-objects (e.g.
vtkSphereSource, vtkLineSource) are rendered at the defined vertices.

    vtkGlyph3D needs a pointer to a vtkPolyData object as input for the
SetSource() method. Therefore I do a:

    float point_list_1[2][3] = { { 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0 } },

    int index_list_1[2] = { 0, 1 };

    vtkPoints *points = vtkPoints::New();
    points->InsertNextPoint( point_list_1[0] );
    points->InsertNextPoint( point_list_1[1] );

    vtkPolyData *poly_data = vtkPolyData::New();
    poly_data->SetPoints( points );
    points->Delete();
    poly_data->InsertNextCell( VTK_LINE, 2, index_list_1 );

... to build a simple straight line, consisting of only two vertices, as
my source object. Afterwards I pass poly_data to the SetSource() method
of my glyph3d:

  vtkGlyph3D *glyph3d = vtkGlyph3D::New();
  glyph3d->SetSource( poly_data );
  glyph3d->SetInput( input_data );
  glyph3d->OrientOn();

  mapper->SetInput( glyph3d->GetOutput() );
  actor->SetMapper( mapper );

    But the program does not render anything :( I also tried different
colors for actor and the window's background and switched to
wireframe-rendering with the 'w'-key, supplied by
vtkRenderWindowInteractor. Nothing did show me anything of my self-build
source-object. If I just replace glyph3d->SetSource( poly_data ) with
e.g. glyph3d->SetSource( sphere_source ), sphere_source gets declared by
me before this call of course :), I see something.

What am I missing here?

Thanks in advance for your time and kind advice!

Ciao...

Mirco



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list