1SoGLRenderAction(3IV)() SoGLRenderAction(3IV)()
2
3
4
6 SoGLRenderAction — renders a scene graph using OpenGL
7
9 SoAction > SoGLRenderAction
10
12 #include <Inventor/actions/SoGLRenderAction.h>
13
14 typedef AbortCode SoGLRenderAbortCB(void *userData)
15 typedef void SoGLRenderPassCB(void *userData)
16
17 enum TransparencyType {
18 SoGLRenderAction::SCREEN_DOOR
19 Uses stipple patterns for screen-door
20 transparency
21 SoGLRenderAction::ADD Uses additive alpha blending
22 SoGLRenderAction::DELAYED_ADD
23 Uses additive blending, rendering all
24 transparent objects after opaque ones
25 SoGLRenderAction::SORTED_OBJECT_ADD
26 Same as DELAYED_ADD, but sorts transparent
27 objects by distances of bounding boxes
28 from camera
29 SoGLRenderAction::BLEND Uses multiplicative alpha blending
30 SoGLRenderAction::DELAYED_BLEND
31 Uses multiplicative alpha blending, render‐
32 ing all transparent objects after
33 opaque ones
34 SoGLRenderAction::SORTED_OBJECT_BLEND
35 Same as DELAYED_BLEND, but sorts transpar‐
36 ent objects by distances of bounding
37 boxes from camera
38 }
39
40 enum AbortCode {
41 SoGLRenderAction::CONTINUE Continue traversal as usual
42 SoGLRenderAction::ABORT Stop traversing the rest of the graph
43 SoGLRenderAction::PRUNE Do not traverse this node or its chil‐
44 dren, but continue
45 SoGLRenderAction::DELAY Delay rendering of this node until the
46 second pass
47 }
48
49 Methods from class SoGLRenderAction:
50
51 SoGLRenderAction(const SbViewportRegion &view‐
52 portRegion)
53 void setViewportRegion(const SbViewportRegion
54 &newRegion)
55 const SbViewportRegion & getViewportRegion() const
56 void setUpdateArea(const SbVec2f &origin, const
57 SbVec2f &size)
58 void getUpdateArea(SbVec2f &origin, SbVec2f &size)
59 const
60 void setAbortCallback(SoGLRenderAbortCB *func, void
61 *userData)
62 void setTransparencyType(TransparencyType type)
63 TransparencyType getTransparencyType() const
64 void setSmoothing(SbBool smooth)
65 SbBool isSmoothing() const
66 void setNumPasses(int num)
67 int getNumPasses() const
68 void setPassUpdate(SbBool flag)
69 SbBool isPassUpdate() const
70 void setPassCallback(SoGLRenderPassCB *func, void
71 *userData)
72 void setCacheContext(uint32_t context)
73 uint32_t getCacheContext() const
74
75 Methods from class SoAction:
76
77 virtual void apply(SoNode *node)
78 virtual void apply(SoPath *path)
79 virtual void apply(const SoPathList &pathList, SbBool obeysRules =
80 FALSE)
81 static SoType getClassTypeId()
82 virtual SoType getTypeId()
83 virtual SbBool isOfType(SoType type)
84 virtual void invalidateState()
85
86
88 This class traverses a scene graph and renders it using the OpenGL
89 graphics library. It assumes that a valid window has been created and
90 initialized for proper OpenGL rendering. The SoXtRenderArea class or
91 any of its subclasses may be used to create such a window.
92
94 SoGLRenderAction(const SbViewportRegion &view‐
95 portRegion)
96 Constructor. The parameter defines the viewport region into which
97 rendering will take place.
98
99 void setViewportRegion(const SbViewportRegion
100 &newRegion)
101 const SbViewportRegion & getViewportRegion() const
102 Changes/returns viewport region to use for rendering.
103
104 void setUpdateArea(const SbVec2f &origin, const
105 SbVec2f &size)
106 void getUpdateArea(SbVec2f &origin, SbVec2f &size)
107 const
108 Sets/returns the current update area, which is the rectangular area
109 of the viewport region that will actually be rendered into. This can
110 be used for partial updates in applications that can manage them.
111 The update area is specified in normalized viewport coordinates,
112 where (0,0) is the lower left corner of the viewport and (1,1) is
113 the upper right corner. The area is specified or returned as an ori‐
114 gin and a size.
115
116 void setAbortCallback(SoGLRenderAbortCB *func, void
117 *userData)
118 Sets callback to call during rendering to test for an abort condi‐
119 tion. It will be called for each node that is traversed. This allows
120 applications to terminate rendering prematurely if some condition
121 occurs. The callback function should return one of the AbortCode
122 codes to indicate whether traversal should continue. Use of the var‐
123 ious codes in a callback can allow applications to modify Inventor's
124 default order of rendering objects in a scene graph.
125
126 void setTransparencyType(TransparencyType type)
127 TransparencyType getTransparencyType() const
128 Sets/returns transparency quality level to use when rendering. The
129 default is SCREEN_DOOR. (Note that SCREEN_DOOR transparency does not
130 work in the case where transparency values are specified for each
131 vertex of a shape. If this is the case, use one of the other trans‐
132 parency types.)
133
134 void setSmoothing(SbBool smooth)
135 SbBool isSmoothing() const
136 Sets/returns smoothing flag. When on, smoothing uses OpenGL's line-
137 and point-smoothing features to provide cheap antialiasing of lines
138 and points. The default is FALSE.
139
140 void setNumPasses(int num)
141 int getNumPasses() const
142 Sets/returns number of rendering passes for multipass rendering.
143 Specifying more than one pass will result in antialiasing of the
144 rendered scene, using OpenGL's accumulation buffer. (Camera nodes
145 typically move their viewpoints a little bit for each pass to
146 achieve the antialiasing.) Each additional pass provides better
147 antialiasing, but requires more rendering time The default is 1
148 pass.
149
150 void setPassUpdate(SbBool flag)
151 SbBool isPassUpdate() const
152 Sets/returns a flag indicating whether intermediate results are dis‐
153 played after each antialiasing pass for progressive improvement
154 (default is FALSE).
155
156 void setPassCallback(SoGLRenderPassCB *func, void
157 *userData)
158 Sets a callback function to invoke between passes when antialiasing.
159 Passing NULL (which is the default state) will cause a clear of the
160 color and depth buffers to be performed.
161
162 void setCacheContext(uint32_t context)
163 uint32_t getCacheContext() const
164 Sets/returns the OpenGL cache context. A cache context is just an
165 integer identifying when OpenGL display lists (which are used for
166 render caching) can be shared between render actions; for example,
167 see the documentation on GLX contexts for information on when OpenGL
168 display lists can be shared between GLX windows.
169
170
172 SoSeparator, SoXtRenderArea
173
174
175
176
177 SoGLRenderAction(3IV)()