]> git.mxchange.org Git - flightgear.git/blob - docs-mini/README.multiscreen
Merge branch 'ehofman/atc-sound' into next
[flightgear.git] / docs-mini / README.multiscreen
1 The Open Scene Graph library, which current FlightGear uses for its 3D
2 graphics, provides excellent support for multiple views of a
3 scene. FlightGear uses the osgViewer::Viewer class, which implements a
4 "master" camera with "slave" cameras that are offset from the master's
5 position and orientation. FlightGear provides the "camera group"
6 abstraction which allows the configuration of slave cameras via the
7 property tree.
8
9 Slave cameras can be mapped to windows that are open on different
10 screens, or all in one window, or a combination of those two schemes,
11 according to the video hardware capabilities of a machine. It is not
12 advisable to open more than one window on a single graphics card due
13 to the added cost of OpenGL context switching between the
14 windows. Usually, multiple monitors attached to a single graphics card
15 are mapped to different pieces of the same desktop, so a window can be
16 opened that spans all the monitors. This is implemented by Nvidia's
17 TwinView technology and the Matrox TripleHead2Go hardware.
18
19 The camera group is configured by the /sim/rendering/camera-group node
20 in the property tree. It can be set up by, among other things, XML in
21 preferences.xml or in an XML file specified on the command line with
22 the --config option.
23
24 Here are the XML tags for defining camera groups.
25
26 camera-group
27 For the moment there can be only one camera group. It can contain
28 window, camera, or gui tags.
29
30  window
31  A window defines a graphics window. It can be at the camera-group
32  level or defined within a camera. The window contains these tags:
33
34   name - string
35   The name of the window which might be displayed in the window's
36   title bar. It is also used to refer to a previously defined
37   window. A window can contain just a name node, in which case
38   the whole window definition refers to a previously defined window.
39
40   host-name - string
41   The name of the host on which the window is opened. Usually this is
42   empty.
43
44   display - int
45   The display number on which the window is opened.
46
47   screen - int
48   The screen number on which the window is opened.
49
50   x, y - int
51   The location on the screen at which the window is opened. This is in
52   the window system coordinates, which usually puts 0,0 at the upper
53   left of the screen XXX check this for Windows.
54
55   width, height - int
56   The dimensions of the window.
57
58   decoration - bool
59   Whether the window manager should decorate the window.
60
61   fullscreen - bool
62   Shorthand for a window that occupies the entire screen with no
63   decoration.
64
65  camera
66  The camera node contains viewing parameters.
67
68   window
69   This specifies the window which displays the camera. Either it
70   contains just a name that refers to a previous window definition, or
71   it is a full window definition.
72
73   viewport
74   The viewport positions a camera within a window. It is most useful
75   when several cameras share a window.
76
77    x, y - int
78    The position of the lower left corner of the viewport, in y-up
79    coordinates.
80
81    width, height - int
82    The dimensions of the viewport
83
84   view
85   The view node specifies the origin and direction of the camera in
86   relation to the whole camera group. The coordinate system is +y up,
87   -z forward in the direction of the camera group view. This is the
88   same as the OpenGL viewing coordinates.
89
90    x,y,z - double
91    Coordinates of the view origin.
92
93    heading-deg, pitch-deg, roll-deg - double
94    Orientation of the view in degrees. These are specified using the
95    right-hand rule, so a positive heading turns the view to the left,
96    a positive roll rolls the view to the left.
97
98   perspective
99   This node is one way of specifying the viewing volume camera
100   parameters. It corresponds to the OpenGL gluPerspective function. 
101
102    fovy-deg - double
103    The vertical field-of-view
104
105    aspect-ratio - double
106    Aspect ratio of camera rectangle (not the ratio between the
107    vertical and horizontal fields of view).
108
109    near, far - double
110    The near and far planes, in meters from the camera eye point. Note
111    that FlightGear assumes that the far plane is far away, currently
112    120km. The far plane specified here will be respected, but the sky
113    and other background elements may not be drawn if the view plane is
114    closer than 120km.
115
116    offset-x, offset-y - double
117    Offsets of the viewing volume specified by the other parameters in
118    the near plane, in meters.
119
120   frustum
121   This specifies the perspective viewing volume using values for the near
122   and far planes and coordinates of the viewing rectangle in the near
123   plane.
124
125    left, bottom - double
126    right, top - double
127    The coordinates of the viewing rectangle.
128
129    near, far - double
130    The near and far planes, in meters from the camera eye point.
131
132   ortho
133   This specifies an orthographic view. The parameters are the sames as
134   the frustum node's.
135
136  gui
137  This is a special camera node that displays the 2D GUI.
138
139   viewport
140   This specifies the position and dimensions of the GUI within a
141   window, *however* at the moment the origin must be at 0,0.
142
143 Here's an example that uses a single window mapped across 3
144 displays. The displays are in a video wall configuration in a
145 horizontal row.
146
147 <PropertyList>
148   <sim>
149     <rendering>
150       <camera-group>
151         <window>
152           <name>wide</name>
153           <host-name type="string"></host-name>
154           <display>0</display>
155           <screen>0</screen>
156           <width>3840</width>
157           <height>1024</height>
158           <decoration type = "bool">false</decoration>
159         </window>
160         <camera>
161           <window>
162             <name>wide</name>
163           </window>
164           <viewport>
165             <x>0</x>
166             <y>0</y>
167             <width>1280</width>
168             <height>1024</height>
169           </viewport>
170           <view>
171             <heading-deg type = "double">0</heading-deg>
172           </view>
173           <frustum>
174             <top>0.133</top>
175             <bottom>-0.133</bottom>
176             <left>-.5004</left>
177             <right>-.1668</right>
178             <near>0.4</near>
179             <far>120000.0</far>
180           </frustum>
181         </camera>
182         <camera>
183           <window>
184             <name type="string">wide</name>
185           </window>
186           <viewport>
187             <x>1280</x>
188             <y>0</y>
189             <width>1280</width>
190             <height>1024</height>
191           </viewport>
192           <view>
193             <heading-deg type = "double">0</heading-deg>
194           </view>
195           <frustum>
196             <top>0.133</top>
197             <bottom>-0.133</bottom>
198             <left>-.1668</left>
199             <right>.1668</right>
200             <near>0.4</near>
201             <far>120000.0</far>
202           </frustum>
203         </camera>
204         <camera>
205           <window>
206             <name>wide</name>
207           </window>
208           <viewport>
209             <x>2560</x>
210             <y>0</y>
211             <width>1280</width>
212             <height>1024</height>
213           </viewport>
214           <view>
215             <heading-deg type = "double">0</heading-deg>
216           </view>
217           <frustum>
218             <top>0.133</top>
219             <bottom>-0.133</bottom>
220             <left>.1668</left>
221             <right>.5004</right>
222             <near>0.4</near>
223             <far>120000.0</far>
224           </frustum>
225         </camera>
226         <gui>
227           <window>
228             <name type="string">wide</name>
229           </window>
230         </gui>
231       </camera-group>
232     </rendering>
233   </sim>
234 </PropertyList>
235
236 Here's a complete example that uses a seperate window on each
237 display. The displays are arranged in a shallow arc with the left and
238 right displays at a 45.3 degree angle to the center display because,
239 at the assumed screen dimensions, the horizontal field of view of one
240 display is 45.3 degrees. Each camera has its own window definition;
241 the center window is given the name "main" so that the GUI definition
242 can refer to it.  Note that the borders of the displays are not
243 accounted for.
244
245 <PropertyList>
246   <sim>
247     <rendering>
248       <camera-group>
249         <camera>
250           <window>
251             <host-name type="string"></host-name>
252             <display>0</display>
253             <screen>0</screen>
254             <fullscreen type = "bool">true</fullscreen>
255           </window>
256           <view>
257             <heading-deg type = "double">45.3</heading-deg>
258           </view>
259           <frustum>
260             <top>0.133</top>
261             <bottom>-0.133</bottom>
262             <left>-.1668</left>
263             <right>.1668</right>
264             <near>0.4</near>
265             <far>120000.0</far>
266           </frustum>
267         </camera>
268         <camera>
269           <window>
270             <name type="string">main</name>
271             <host-name type="string"></host-name>
272             <display>0</display>
273             <screen>1</screen>
274             <fullscreen type = "bool">true</fullscreen>
275           </window>
276           <view>
277             <heading-deg type = "double">0</heading-deg>
278           </view>
279           <frustum>
280             <top>0.133</top>
281             <bottom>-0.133</bottom>
282             <left>-.1668</left>
283             <right>.1668</right>
284             <near>0.4</near>
285             <far>120000.0</far>
286           </frustum>
287         </camera>
288         <camera>
289           <window>
290             <host-name type="string"></host-name>
291             <display>0</display>
292             <screen>2</screen>
293             <fullscreen type = "bool">true</fullscreen>
294           </window>
295           <view>
296             <heading-deg type = "double">-45.3</heading-deg>
297           </view>
298           <frustum>
299             <top>0.133</top>
300             <bottom>-0.133</bottom>
301             <left>-.1668</left>
302             <right>.1668</right>
303             <near>0.4</near>
304             <far>120000.0</far>
305           </frustum>
306         </camera>
307         <gui>
308           <window>
309             <name type="string">main</name>
310           </window>
311         </gui>
312       </camera-group>
313     </rendering>
314   </sim>
315 </PropertyList>