[vtkusers] vtkScaledTextActor & offscreen
Berk Geveci
berk.geveci at kitware.com
Tue Apr 9 16:38:39 EDT 2002
I can confirm (with a similar linux machine). I can't
explain why though. All the necessary offscreen code
is in Rendering/vtkXOpenGLRenderWindow.{h|cxx}. Maybe
someone who knows Mesa better can take a look at it ?
-Berk
On Tue, 2002-04-09 at 13:49, Randy Heiland wrote:
> 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 .
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list