[vtkusers] Text Stacking

Matthew Seier mattie_seier at hotmail.com
Wed Jul 7 14:19:43 EDT 2004


Hey all (again),

Using sprintf, I got the angles of the camera I was rotating to display on 
the screen, and dynamically update by putting the outputting code in my 
rotation loop.  Unfortunately, the text stacks on top of itself, so that 
after rotating for a few seconds, angle data has piled up, and the text is a 
white blob. Does anyone know how to clean off the text so that more text can 
be placed on top?  The section of C++ code which renders the text is as 
follows:

//After the camera has been rotated:
vtkRenderer *ren = this->CurrentRenderer;
   vtkActor2D *textor = vtkActor2D::New();
	ren->AddActor(textor);
	vtkTextMapper *textmap = vtkTextMapper::New();
	textor->GetProperty()->SetColor(1,1,1);
	textor->SetPosition(10,200);
	textor->SetPosition2(400,350);
	textor->SetMapper(textmap);
anglex = anglex + rxf;                                   //rxf= angle the 
camera was rotated through
sprintf(buffer,"Angle x=  %f", anglex);             // anglex and buffer are 
global variables
textmap->SetInput(buffer);
   rwi->Render();
   textor->Delete();
   textmap->Delete();
   ren->Clear();
if(anglex > 360)
{
	anglex=anglex-360;
}
if(anglex < -360)
{
	anglex=anglex+360;
}

Thanks a million,
Matt

_________________________________________________________________
MSN 9 Dial-up Internet Access helps fight spam and pop-ups – now 2 months 
FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/




More information about the vtkusers mailing list