[vtkusers] Coloring a parametetirc surface?
motes motes
mort.motes at gmail.com
Thu Apr 22 07:10:46 EDT 2010
I have this .tcl script (renders a Boy surface):
# ------------------------------------------------------------
# Call the VTK Tcl packages to make available all VTK commands
# ------------------------------------------------------------
package require vtk
package require vtkinteraction
# ------------------------------------------------------------
# Create a Boy surface
# ------------------------------------------------------------
vtkParametricBoy boy
vtkParametricFunctionSource boySource
boySource SetParametricFunction boy
boySource SetScalarModeToV
vtkPolyDataMapper boyMapper
boyMapper SetInputConnection [boySource GetOutputPort]
boyMapper SetScalarRange -1 1
vtkActor boyActor
boyActor SetMapper boyMapper
# Setting color does not work!
[boyActor GetProperty] SetColor 1 0 0
# ------------------------------------------------------------
# Create the RenderWindow, Renderer and Interactor
# ------------------------------------------------------------
vtkRenderer ren1
ren1 SetBackground 0.7 0.8 1
vtkRenderWindow renWin
renWin AddRenderer ren1
renWin SetSize 800 800
renWin SetWindowName "Boy surface"
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# add actors
ren1 AddViewProp boyActor
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren AddObserver ExitEvent {exit}
renWin Render
boyActor SetPosition 0 0 0
[ren1 GetActiveCamera] Zoom 1.5
# prevent the tk window from showing up then start the event loop
wm withdraw .
Now I would like to change the color of the surface therefore I do:
[boyActor GetProperty] SetColor 1 0 0
But I has no effect, any ideas?
More information about the vtkusers
mailing list