1SoXtRenderArea(3IV)() SoXtRenderArea(3IV)()
2
3
4
6 SoXtRenderArea — Xt Component for rendering Inventor scene graphs
7
9 SoXtComponent > SoXtGLWidget > SoXtRenderArea
10
12 #include <Inventor/Xt/SoXtRenderArea.h>
13
14 typedef SbBool SoXtRenderAreaEventCB(void *userData, XAnyEvent
15 *anyevent)
16
17 Methods from class SoXtRenderArea:
18
19 SoXtRenderArea(Widget parent = NULL, const char
20 *name = NULL, SbBool buildInsideParent =
21 TRUE, SbBool getMouseInput = TRUE, SbBool
22 getKeyboardInput = TRUE)
23 ~SoXtRenderArea()
24 virtual void setSceneGraph(SoNode *newScene)
25 virtual SoNode * getSceneGraph()
26 void setOverlaySceneGraph(SoNode *newScene)
27 SoNode * getOverlaySceneGraph()
28 void registerDevice(SoXtDevice *)
29 void unregisterDevice(SoXtDevice *)
30 void setBackgroundColor(const SbColor &c)
31 const SbColor & getBackgroundColor() const
32 void setBackgroundIndex(int index)
33 int getBackgroundIndex() const
34 void setOverlayBackgroundIndex(int index)
35 int getOverlayBackgroundIndex() const
36 void setColorMap(int startIndex, int num, const
37 SbColor *colors)
38 void setOverlayColorMap(int startIndex, int num,
39 const SbColor *colors)
40 void setViewportRegion(const SbViewportRegion
41 &newRegion)
42 const SbViewportRegion & getViewportRegion() const
43 void setTransparencyType(SoGLRenderAction::Trans‐
44 parencyType type)
45 SoGLRenderAction::TransparencyType
46 getTransparencyType() const
47 void setAntialiasing(SbBool smoothing, int
48 numPasses)
49 void getAntialiasing(SbBool &smoothing, int
50 &numPasses) const
51 void setClearBeforeRender(SbBool trueOrFalse)
52 SbBool isClearBeforeRender() const
53 void setClearBeforeOverlayRender(SbBool trueOrFalse)
54 SbBool isClearBeforeOverlayRender() const
55 void setAutoRedraw(SbBool trueOrFalse)
56 SbBool isAutoRedraw() const
57 void setRedrawPriority(uint32_t priority)
58 uint32_t getRedrawPriority() const
59 static uint32_t getDefaultRedrawPriority()
60 void render()
61 void renderOverlay()
62 void scheduleRedraw()
63 void scheduleOverlayRedraw()
64 void redrawOnSelectionChange(SoSelection *s)
65 void redrawOverlayOnSelectionChange(SoSelection *s)
66 void setEventCallback(SoXtRenderAreaEventCB *fcn,
67 void *userData = NULL)
68 void setGLRenderAction(SoGLRenderAction *ra)
69 SoGLRenderAction * getGLRenderAction() const
70 void setOverlayGLRenderAction(SoGLRenderAction *ra)
71 SoGLRenderAction * getOverlayGLRenderAction() const
72 void setSceneManager(SoSceneManager *sm)
73 SoSceneManager * getSceneManager() const
74 void setOverlaySceneManager(SoSceneManager *sm)
75 SoSceneManager * getOverlaySceneManager() const
76
77 Methods from class SoXtGLWidget:
78
79 void setBorder(SbBool onOrOff)
80 SbBool isBorder() const
81 virtual void setDoubleBuffer(SbBool onOrOff)
82 SbBool isDoubleBuffer()
83 Window getNormalWindow()
84 Window getOverlayWindow()
85 GLXContext getNormalContext()
86 GLXContext getOverlayContext()
87 Widget getNormalWidget()
88 Widget getOverlayWidget()
89 virtual void setNormalVisual(XVisualInfo *vis)
90 XVisualInfo * getNormalVisual()
91 virtual void setOverlayVisual(XVisualInfo *vis)
92 XVisualInfo * getOverlayVisual()
93 void setDrawToFrontBufferEnable(SbBool enableFlag)
94 SbBool isDrawToFrontBufferEnable() const
95
96 Methods from class SoXtComponent:
97
98 virtual void show()
99 virtual void hide()
100 SbBool isVisible()
101 Widget getWidget() const
102 SbBool isTopLevelShell() const
103 Widget getShellWidget() const
104 Widget getParentWidget() const
105 void setSize(const SbVec2s &size)
106 SbVec2s getSize()
107 Display * getDisplay()
108 void setTitle(const char *newTitle)
109 const char * getTitle() const
110 void setIconTitle(const char *newIconTitle)
111 const char * getIconTitle() const
112 void setWindowCloseCallback(SoXtComponentCB *func,
113 void *data = NULL)
114 static SoXtComponent * getComponent(Widget w)
115 const char * getWidgetName() const
116 const char * getClassName() const
117
118
120 This class provides Inventor rendering and event handling inside a GLX
121 Motif widget. There is a routine to specify the scene to render. The
122 scene is automatically rendered whenever anything under it changes (a
123 data sensor is attached to the root of the scene), unless explicitly
124 told not to do so (manual redraws). Users can also set Inventor render‐
125 ing attributes such as the transparency type, antialiasing on or off,
126 etc. This class employs an SoSceneManager to manage rendering and event
127 handling.
128
129 X events that occur in the render area can be handled by the applica‐
130 tion, by the viewer (if this is really a viewer) or by the nodes in the
131 scene graph. When an event occurs, it is first passed to the applica‐
132 tion event callback function registered with the setEventCallback()
133 method on SoXtRenderArea. If this function does not exist or returns
134 FALSE, the X event is either used directly by the viewer or translated
135 to an SoEvent for further scene graph processing. If the viewer does
136 not handle the event, and an overlay scene graph exists, the SoEvent is
137 sent to that scene graph by way of an SoHandleEventAction. If no node
138 in the overlay scene graph handles the event (i.e., calls setHandled()
139 on the SoHandleEventAction), the SoEvent is passed to the normal scene
140 graph in the same manner.
141
143 SoXtRenderArea(Widget parent = NULL, const char
144 *name = NULL, SbBool buildInsideParent =
145 TRUE, SbBool getMouseInput = TRUE, SbBool
146 getKeyboardInput = TRUE)
147 ~SoXtRenderArea()
148 Constructor which is passed arguments which tell it whether to reg‐
149 ister the mouse and keyboard devices by default (SoXtMouse and SoX‐
150 tKeyboard).
151
152 virtual void setSceneGraph(SoNode *newScene)
153 virtual SoNode * getSceneGraph()
154 Set/get the scene graph to be rendered in this component's window.
155
156 void setOverlaySceneGraph(SoNode *newScene)
157 SoNode * getOverlaySceneGraph()
158 Sets/gets the scene graph to render in the overlay bit planes.
159
160 Note: since the overlay bit planes are in color index mode, single
161 buffer with a limited number of colors, the user should limit ren‐
162 dering in the overlay planes to simple objects.
163
164 Typically rendering in color index mode is done using the SoCol‐
165 orIndex node with a SoLightModel set to BASE_COLOR.
166
167 void registerDevice(SoXtDevice *)
168 void unregisterDevice(SoXtDevice *)
169 Register/unregister interest in devices. When a device is regis‐
170 tered, events from that device will be processed by the render area,
171 and passed into the scene graph. Events from unregistered devices
172 will be ignored.
173
174 void setBackgroundColor(const SbColor &c)
175 const SbColor & getBackgroundColor() const
176 Set/get the background color for this window. Default is black
177 (0,0,0).
178
179 void setBackgroundIndex(int index)
180 int getBackgroundIndex() const
181 Sets/gets the window background color when in color index mode.
182 (default to black (index 0)).
183
184 void setOverlayBackgroundIndex(int index)
185 int getOverlayBackgroundIndex() const
186 Sets/gets the overlay window background color index. (default to 0
187 (clear color)).
188
189 void setColorMap(int startIndex, int num, const
190 SbColor *colors)
191 Sets the colors to use when displaying in color index mode. This
192 will load the color map with the given colors at the starting index.
193
194 void setOverlayColorMap(int startIndex, int num,
195 const SbColor *colors)
196 Sets the colors to use for overlay bit planes.This will load the
197 color map with the given colors at the starting index.
198
199 void setViewportRegion(const SbViewportRegion
200 &newRegion)
201 const SbViewportRegion & getViewportRegion() const
202 Sets/gets current viewport region to use for rendering
203
204 void setTransparencyType(SoGLRenderAction::Trans‐
205 parencyType type)
206 SoGLRenderAction::TransparencyType
207 getTransparencyType() const
208 Set/get the quality level for rendering transparent objects. See
209 SoGLRenderAction for possible transparency types.
210
211 void setAntialiasing(SbBool smoothing, int
212 numPasses)
213 void getAntialiasing(SbBool &smoothing, int
214 &numPasses) const
215 Set/get the antialiasing for rendering. There are two kinds of
216 antialiasing available: smoothing and multipass antialiasing. If
217 smoothing is set to TRUE, smoothing is enabled. Smoothing uses
218 OpenGL's line- and point-smoothing features to provide cheap
219 antialiasing of lines and points. The value of numPasses controls
220 multipass antialiasing. Each time a render action is applied, Inven‐
221 tor renders the scene numPasses times from slightly different camera
222 positions, averaging the results. numPasses can be from one to 255,
223 inclusive. Setting numPasses to one disables multipass antialiasing.
224 You can use either, both, or neither of these antialiasing tech‐
225 niques. By default, both smoothing and multipass antialiasing are
226 disabled.
227
228 void setClearBeforeRender(SbBool trueOrFalse)
229 SbBool isClearBeforeRender() const
230 Enable/prevent window clearing from happening before a rendering
231 starts (default is clear TRUE). This can be useful to limit flicker‐
232 ing when doing single buffering and geometry covers the entire win‐
233 dow (used in the material editor).
234
235 void setClearBeforeOverlayRender(SbBool trueOrFalse)
236 SbBool isClearBeforeOverlayRender() const
237 Enable/prevent overlay window clearing from happening before a ren‐
238 dering starts (default is clear TRUE).
239
240 void setAutoRedraw(SbBool trueOrFalse)
241 SbBool isAutoRedraw() const
242 The render area will automatically redraw whenever something in the
243 scene graph changes. Passing FALSE will disable this feature.
244
245 void setRedrawPriority(uint32_t priority)
246 uint32_t getRedrawPriority() const
247 static uint32_t getDefaultRedrawPriority()
248 Sets/gets the priority of the redraw sensor and get the default pri‐
249 ority number.
250
251 void render()
252 void renderOverlay()
253 Calling this forces the render area to be redrawn now. It is not
254 necessary to call this method if auto redraw is enabled (which is
255 the default).
256
257 void scheduleRedraw()
258 void scheduleOverlayRedraw()
259 Schedule a redraw to happen sometime soon (as opposed to immedi‐
260 ately). This can be used to compress multiple redraws.
261
262 void redrawOnSelectionChange(SoSelection *s)
263 void redrawOverlayOnSelectionChange(SoSelection *s)
264 Call this convenience method to have this render area redraw when‐
265 ever the selection list changes in the passed node. This is useful
266 if using a highlight render action like the SoBoxHighlightRenderAc‐
267 tion to correctly render whenever the selection changes. Pass NULL
268 to turn this off.
269
270 void setEventCallback(SoXtRenderAreaEventCB *fcn,
271 void *userData = NULL)
272 X events which occur in the render area window are either directly
273 handled by the viewer (when this is really a viewer) or automati‐
274 cally translated to SoEvents, then passed into the scene graph (via
275 the SoHandleEventAction) so that live scene graph objects can handle
276 the event (when viewers are not in viewing mode). This method allows
277 the application to register a callback for handling events that
278 occur in the window, instead of sending them to the viewers or down
279 the graph. The callback is passed the X event, and should return
280 TRUE if it handled the event. If the callback returns FALSE, then
281 the event will be handled by the render area.
282
283 void setGLRenderAction(SoGLRenderAction *ra)
284 SoGLRenderAction * getGLRenderAction() const
285 Sets/gets the GL render action to use. This is used to set selection
286 highlighting with the SoBoxHighlightRenderAction and SoLineHigh‐
287 lightRenderAction classes.
288
289 void setOverlayGLRenderAction(SoGLRenderAction *ra)
290 SoGLRenderAction * getOverlayGLRenderAction() const
291 Sets/gets the GL render action for the overlay window.
292
293 void setSceneManager(SoSceneManager *sm)
294 SoSceneManager * getSceneManager() const
295 void setOverlaySceneManager(SoSceneManager *sm)
296 SoSceneManager * getOverlaySceneManager() const
297 Sets/gets the normal and overlay plane scene managers.
298
299 Note: for convenience most of the SoSceneManager methods have
300 already been added to this class.
301
302
304 *SoXtRenderArea*BackgroundColor: black (color name or hex value)
305
306
307
309 SoXtGLWidget, SoXtComponent, SoXtViewer, SoSceneManager, SoBoxHigh‐
310 lightRenderAction, SoLineHighlightRenderAction
311
312
313
314
315 SoXtRenderArea(3IV)()