source: development/steve/visualisation/Tutorial/Step3/Cone3.tcl @ 2229

Last change on this file since 2229 was 2229, checked in by steve, 19 years ago

Moved directories into production and development parent directories

File size: 2.8 KB
Line 
1#
2# This example demonstrates how to use multiple renderers within a
3# render window. It is a variation of the Cone.tcl example. Please
4# refer to that example for additional documentation.
5#
6
7#
8# First we include the VTK Tcl packages which will make available
9# all of the VTK commands to Tcl.
10#
11package require vtk
12
13#
14# Next we create an instance of vtkConeSource and set some of its
15# properties. The instance of vtkConeSource "cone" is part of a visualization
16# pipeline (it is a source process object); it produces data (output type is
17# vtkPolyData) which other filters may process.
18#
19vtkConeSource cone
20cone SetHeight 3.0
21cone SetRadius 1.0
22cone SetResolution 10
23
24#
25# In this example we terminate the pipeline with a mapper process object.
26# (Intermediate filters such as vtkShrinkPolyData could be inserted in
27# between the source and the mapper.)  We create an instance of
28# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
29# connect the output of the cone souece to the input of this mapper.
30#
31vtkPolyDataMapper coneMapper
32coneMapper SetInput [cone GetOutput]
33
34#
35# Create an actor to represent the cone. The actor orchestrates rendering of
36# the mapper's graphics primitives. An actor also refers to properties via a
37# vtkProperty instance, and includes an internal transformation matrix. We
38# set this actor's mapper to be coneMapper which we created above.
39#
40vtkActor coneActor
41coneActor SetMapper coneMapper
42
43#
44# Create two renderers and assign actors to them. A renderer renders into a
45# viewport within the vtkRenderWindow. It is part or all of a window on the
46# screen and it is responsible for drawing the actors it has.  We also set
47# the background color here. In this example we are adding the same actor
48# to two different renderers; it is okay to add different actors to
49# different renderers as well.
50#
51vtkRenderer ren1
52ren1 AddActor coneActor
53ren1 SetBackground 0.1 0.2 0.4
54ren1 SetViewport 0.0 0.0 0.5 1.0
55
56vtkRenderer ren2
57ren2 AddActor coneActor
58ren2 SetBackground 0.1 0.2 0.4
59ren2 SetViewport 0.5 0.0 1.0 1.0
60
61#
62# Finally we create the render window which will show up on the screen.
63# We add our two renderers into the render window using AddRenderer. We also
64# set the size to be 600 pixels by 300.
65#
66vtkRenderWindow renWin
67renWin AddRenderer ren1
68renWin AddRenderer ren2
69renWin SetSize 600 300
70
71#
72# Make one camera view 90 degrees from other.
73#
74  [ren1 GetActiveCamera] Azimuth 90
75
76#
77# Now we loop over 360 degreeees and render the cone each time.
78#
79for {set i 0} {$i < 360} {incr i} {
80   after 10
81   # render the image
82   renWin Render
83   # rotate the active camera by one degree
84   [ren1 GetActiveCamera] Azimuth 1
85   [ren2 GetActiveCamera] Azimuth 1
86}
87
88#
89# Free up any objects we created.
90#
91vtkCommand DeleteAllObjects
92
93#
94# Exit the application.
95#
96exit
Note: See TracBrowser for help on using the repository browser.