[vtkusers] vtkScaledTextActor & offscreen

Randy Heiland heiland at ncsa.uiuc.edu
Tue Apr 9 13:49:25 EDT 2002


Can someone tell me why a vtkScaledTextActor doesn't appear in a (Mesa)
offscreen rendering (but does for onscreen)?  (VTK4.0, Mesa 4.0, RH7.2)

Else, can someone confirm/deny?

thanks,
--Randy

Here are simple Python & Tcl scripts:

-------------------------------------
from vtk import *

ren1 = vtkRenderer()

renWin = vtkRenderWindow()
renWin.AddRenderer(ren1)


offscreen = 1
offscreen = 0
if offscreen > 0:
  renWin.SetOffScreenRendering(1)
else:
  iren= vtkRenderWindowInteractor()
  iren.SetRenderWindow(renWin)

text1Actor = vtkScaledTextActor()
text1Mapper = vtkTextMapper()
text1Actor.SetMapper(text1Mapper)
text1Mapper.SetInput('frame=')
#text1Mapper.SetFontSize(14)
text1Actor.GetProperty().SetColor(1.0,1.0,1.0)
ren1.AddActor2D(text1Actor)

renWin.Render()

w2if = vtkWindowToImageFilter()
w2if.SetInput( renWin )
pnmWriter = vtkPNMWriter()
pnmWriter.SetInput(w2if.GetOutput())
pnmWriter.SetFileName("img1.pnm")
pnmWriter.Write()

if offscreen == 0:
  iren.Start()

----------------------------------------
package require vtk
package require vtkinteraction

vtkRenderer ren1
vtkRenderWindow renWin
 renWin AddRenderer ren1

vtkRenderWindowInteractor iren
#iren SetRenderWindow renWin

renWin SetOffScreenRendering 1
#renWin SetOffScreenRendering 0

vtkScaledTextActor text1Actor
vtkTextMapper text1Mapper
text1Actor SetMapper text1Mapper
text1Mapper SetInput "this is a silly test"
#text1Mapper SetFontSize(14)
#[text1Actor GetProperty] SetColor(1.0,1.0,1.0)
ren1 AddActor2D text1Actor

renWin Render

vtkWindowToImageFilter w2if
w2if SetInput  renWin
vtkPNMWriter pnmWriter
pnmWriter SetInput [w2if GetOutput]
pnmWriter SetFileName "img1.pnm"
pnmWriter Write


#iren Initialize
#iren AddObserver UserEvent {wm deiconify .vtkInteract}

# prevent the tk window from showing up then start the event loop
#wm withdraw .



More information about the vtkusers mailing list