[vtkusers] Help - VTK

Bill Lorensen bill.lorensen at gmail.com
Mon Jun 22 08:49:40 EDT 2009


To display text in a window you can use
vtkTextProperty, vtkTextMapper and a vtkActor2D.

The property defines the font, style and size of the text.
The Mapper defines the text string.
The Actor2D positions the text.

For example, in tcl, here is a script that display the time of day
before each render:


package require vtk
package require vtkinteraction

vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
    renWin SetSize 512 512
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

vtkSphereSource sphereModel

vtkPolyDataMapper sphereMapper
  sphereMapper SetInput [sphereModel GetOutput]

vtkActor sphereActor
  sphereActor SetMapper sphereMapper

vtkTextProperty clockProperty
  clockProperty SetFontSize 14
  clockProperty SetJustificationToLeft
  clockProperty SetVerticalJustificationToBottom
  clockProperty ShadowOn

set now [clock format [clock seconds]]
vtkTextMapper clockMapper
  clockMapper SetInput "Date: $now"
  clockMapper SetTextProperty clockProperty
vtkActor2D clockActor
  clockActor SetPosition 14 14
  clockActor SetMapper clockMapper

ren1 AddActor clockActor
ren1 AddActor sphereActor

renWin AddObserver StartEvent {set now [clock format [clock seconds]];
clockMapper SetInput "Date: $now"}

#---Render the image
iren AddObserver UserEvent {wm deiconify .vtkInteract}
renWin Render


iren Initialize


On Mon, Jun 22, 2009 at 2:47 AM, Claude G.<claude.gangolf at gmail.com> wrote:
> Hi,
>
> I'm a beginner in VTK and i working on a projet but i have some problems.
>
> I want to display numerical values, like a timer, or values from a float
> array, in the main window where all the other actors are shown but i have no
> idea how i could do this, please help me.
>
> Secondly, i want to manipulate object which are added in the main window,
> like placing a sphere in a new position without creating a new sphere and
> deleting the old one an then adding the new to have the new postion of the
> sphere added.
>
> thanks a lot for your help
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list