[vtkusers] vtkProgrammableGlyphFilter C++ class Issue
Steffen Oeltze
stoeltze at isg.cs.uni-magdeburg.de
Sun Feb 20 10:05:57 EST 2011
Hi,
I have written a class in C++ that is using a
vtkProgrammableGlyphFilter. In the method that is called for each glyph,
I pass a pointer to the filter. By doing so, I can access the input data
of the filter and its associated point data arrays in the method. I need
the latter for glyph modification. My problem is, that I cannot access
the glyph source and the vtkTransform that I am using for positioning
the glyphs in a similar manner. Instead, I have to define both globally.
So far that has not been a problem. However, now that I am using several
instances of my class, I run into problems (the glyphs are not visible
anymore in a viewer that uses the second instance). I guess that these
problems are related to my global definitions.
Any help is deeply appreciated.
Sincerely,
Steffen
Here, a code snippet:
g_vertexGlyph = vtkSmartPointer<vtkSectorSource>::New(); // globally defined
g_vertexGlyph->SetOuterRadius(0.05);
g_vertexGlyph->SetInnerRadius(0.0);
g_vertexGlyph->SetStartAngle(0.0);
g_vertexGlyph->SetEndAngle(270.0);
g_vertexGlyph->SetCircumferentialResolution(12);
g_vertexGlyph->SetZCoord(0.0);
g_vertexGlyphTransform = vtkSmartPointer<vtkTransform>::New(); //
globally defined
vtkSmartPointer<vtkTransformPolyDataFilter > glyphTransform =
vtkSmartPointer<vtkTransformPolyDataFilter>::New();
glyphTransform->SetInput(g_vertexGlyph->GetOutput());
glyphTransform->SetTransform(g_vertexGlyphTransform);
glyphTransform->ReleaseDataFlagOn();
vtkSmartPointer<vtkProgrammableGlyphFilter> progGlyphs =
vtkSmartPointer<vtkProgrammableGlyphFilter>::New();
progGlyphs->SetInput(graphToPoly->GetOutput());
progGlyphs->SetSource(glyphTransform->GetOutput());
progGlyphs->SetColorModeToColorByInput();
progGlyphs->SetGlyphMethod(glyphAttribModif, (void *)progGlyphs);
progGlyphs->ReleaseDataFlagOn();
More information about the vtkusers
mailing list