[vtkusers] How to make 2D Glyphs

Elvis Dowson elvis.dowson at mac.com
Sat Oct 4 03:22:24 EDT 2008


Hi,
         I am trying to make a 2D Glyph, but nothing gets displayed in  
the following code:

	// Prototype: 2D Glyph Source
	// ----------------------------
	#ifdef PROTOTYPE_2D_GLYPH_SOURCE
	{
		// Declare object instance variables
		vtkGlyphSource2D*	glyphSource	= NULL;
		vtkGlyph2D*		glyphDiamond	= NULL;
		vtkActor2D*		glyphActor	= NULL;
		
		// Generate 2D Glyph: Diamond
		glyphSource = vtkGlyphSource2D::New();
		glyphSource->SetGlyphTypeToDiamond();
		glyphSource->SetScale(0.2);
		glyphSource->FilledOff();
		
		glyphDiamond = vtkGlyph2D::New();
		glyphDiamond->SetSource(glyphSource->GetOutput());
		glyphDiamond->ScalingOff();
		glyphDiamond->OrientOn();
		glyphDiamond->SetVectorModeToUseVector();
		glyphDiamond->SetColorModeToColorByVector();
		
		// Rendering objects.
		vtkPolyDataMapper2D* mapperGlyph = NULL;
		mapperGlyph = vtkPolyDataMapper2D::New();
		mapperGlyph->SetInputConnection(glyphDiamond->GetOutputPort());
		mapperGlyph->SetScalarRange(50, 180);
		
		// Add actor to renderer
		glyphActor = vtkActor2D::New();
		glyphActor->SetMapper(mapperGlyph);
		
		// Add Actor to renderer
		ren->AddActor2D(glyphActor);		
	}
	#endif

Best regards,

Elvis Dowson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081004/3e5a5066/attachment.htm>


More information about the vtkusers mailing list