[vtkusers] How to change source in vtkProgrammableGlyphFilter

Jong Youl Choi jychoi at indiana.edu
Tue Aug 24 09:31:23 EDT 2010


You are right. The code I showed has no fancy thing yet. Basically, I
want to assign a different glyph on each vertex (or point) so that a
graph looks like a mixture of sphere, cube, cone, etc.

Thanks,
Jong

On Tue, Aug 24, 2010 at 7:22 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Mon, Aug 23, 2010 at 11:26 PM, Jong Youl Choi <jychoi at indiana.edu> wrote:
>>
>> Hi all,
>>
>> I have tried to change a source (from sphere to cone) in
>> vtkProgrammableGlyphFilter with no luck. My code is as follow:
>>
>>        vtkProgrammableGlyphFilter *glyph =
>> vtkProgrammableGlyphFilter::New();
>>        vtkSphereSource *sphere = vtkSphereSource::New();
>>        glyph->SetInput(plot); // plot is vtkPolyData
>>        glyph->SetSource(sphere->GetOutput()); // sphere is vtkSphereSource
>>        glyph->SetGlyphMethod(CalcGlyph, glyph);
>>
>> And CalcGlyph is defined:
>>
>> void CalcGlyph(void *arg)
>> {
>>        vtkProgrammableGlyphFilter *glyph = (vtkProgrammableGlyphFilter*)
>> arg;
>>        VTK_CREATE(vtkConeSource, cone);
>>        glyph->SetSource(cone->GetOutput());  // Tried to reset the source
>>
>>        double xyz[3];
>>        glyph->GetPoint(xyz);
>>
>>        cone->SetCenter(xyz);
>> }
>>
>> Is there any way to replace or change the source initially defined in
>> vtkProgrammableGlyphFilter? Thank you for your help in advance.
>>
>> Thanks,
>> Jong
>>
>> --
>> Jong Youl Choi
> I'm not familiar with vtkProgrammableGlyphFilter, but it doesn't sound like
> you're doing anything that vtkGlyph3D can't do:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ScaleGlyphs
> David
>



-- 
Jong Youl Choi
Dept. of Computer Science
Indiana University at Bloomington
Homepage: http://www.cs.indiana.edu/~jychoi



More information about the vtkusers mailing list