[vtkusers] Bug vtkTextActor ShadowOn

Jon Waite JonW at pathsurg.com
Mon May 11 17:10:32 EDT 2009


All,

The text actor's shadow is not rendering correctly, creating a cropped
and hard to read display. [see code below]

Jon

--------------------------------

#include "vtkRenderWindowInteractor.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkActor.h"
#include "vtkWin32OpenGLRenderWindow.h"
#include "vtkWin32RenderWindowInteractor.h"
#include "vtkTextProperty.h"
#include "vtkTextActor.h"
#include "vtkCoordinate.h"

int _tmain(int argc, _TCHAR* argv[])
{
	vtkWin32OpenGLRenderWindow *renWin = vtkWin32OpenGLRenderWindow::New();
	vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
	iren->SetRenderWindow(renWin);
	iren->Initialize();

	vtkRenderer *renderer = vtkRenderer::New();
	renWin->AddRenderer(renderer);
	if(1)
	{
		if (1)
		{
			vtkTextActor* InfoTipTextActor = vtkTextActor::New();
			InfoTipTextActor->SetInput("Error");
			vtkTextProperty* textprop  = InfoTipTextActor->GetTextProperty();
			textprop->SetColor(1,1,1);
			textprop->SetFontSize(16);
			textprop->ShadowOn();
			textprop->SetJustificationToLeft();
			textprop->SetVerticalJustificationToBottom();

			vtkCoordinate* coord = InfoTipTextActor->GetPositionCoordinate();
			coord->SetCoordinateSystemToNormalizedViewport();
			coord->SetValue(0.5,0.5);

			renderer->AddViewProp(InfoTipTextActor);
			InfoTipTextActor->Delete();
		}

		renderer->ResetCamera();
		renderer->Render();
	}

	iren->Start();

	renderer->Delete();
	renWin->Delete();
	iren->Delete();

	return 0;
}



More information about the vtkusers mailing list