How to Showing 3 things in a VTK window
Cosine Cheng
acosine at taiwan.com
Fri Feb 25 14:25:58 EST 2000
Hi:
I wrote a VTK script that can change the color
of a cube in the window. Then I start to think
that how to put several things in ONE window but still have
the control to each object.
Say, I put a cube, a sphere, and a rectangular in one window.
Then I can change the color INDIVIDUALLY for the cube, the sphere,
and the rectangular to Red, Green, or Blue color.
How can I do that?
Below is my VTK script.
# ui2.tcl
catch {load vtktcl}
source E:/WIN32APP/vtk24/examples/vtkInt.tcl
vtkRenderer ren
vtkRenderWindow renWin
renWin AddRenderer ren
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkCubeSource cube
vtkPolyDataMapper cubeMapper
cubeMapper SetInput [cube GetOutput]
vtkActor cubeActor
cubeActor SetMapper cubeMapper
[cubeActor GetProperty] SetColor 1 0 0
# these three functions are called by the buttons
proc setR {} {
[cubeActor GetProperty] SetColor 1 0 0
renWin Render
}
proc setG {} {
[cubeActor GetProperty] SetColor 0 1 0
renWin Render
}
proc setB {} {
[cubeActor GetProperty] SetColor 0 0 1
renWin Render
}
frame .f
button .f.bR -text "red" -command setR
button .f.bG -text "green" -command setG
button .f.bB -text "blue" -command setB
pack .f .f.bR .f.bG .f.bB
ren AddActor cubeActor
renWin Render
_______________________________________________
Get your free email from http://freemail.taiwan.com
powered by OutBlaze
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list