Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoGuiGLWidget.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : T.MEHAMLI (Jun 2007)
22**=======================================================================*/
23
24#ifndef SO_GUI_GL_WIDGET_H
25#define SO_GUI_GL_WIDGET_H
26
28//
29// Class: SoGuiGLWidget
30//
31// SoXXGLWidgets implementation class
32//
33//
35
36#include <Inventor/antialiasing/SiAntialiasingEventListener.h>
37#include <Inventor/Gui/SoGuiComponent.h>
38#include <Inventor/fields/SoSFInt32.h>
39#include <Inventor/fields/SoSFFloat.h>
40#include <Inventor/devices/SoGLFormat.h>
41#include <Inventor/nodes/SoFullSceneAntialiasing.h>
42#include <Inventor/image/SbRasterImage.h>
43
45
46#ifndef HIDDEN_FROM_DOC
47typedef SbBool (*soGUIDependentCB)(void* data);
48typedef void* (*soGUIWindowDependentCB)(void* data);
49#endif
50
51
53{
54#ifndef HIDDEN_FROM_DOC
55 SO_FIELDCONTAINER_HEADER( SoGuiGLWidget );
56#endif
57
58private:
59
60 SoSFFieldContainer gcTemplate;
61 SoSFBool focus;
62
63 enum FloatColorBufferSize
64 {
68 FLOAT_16_COLOR_BUFFER = 0,
72 FLOAT_32_COLOR_BUFFER = 1
73 };
74
79
83 void setAntialiasing(const float quality, const SoSceneManager::AntialiasingMode mode = SoSceneManager::AUTO);
84
88 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
89
93 float getAntialiasingQuality() const;
94
98 SoSceneManager::AntialiasingMode getAntialiasingMode() const;
99
103 SoAntialiasingParameters* getAntialiasingParameters() const;
104
108 void setColorMapSize( int size );
109
113 int getColorMapSize();
114
118 SbBool isDoubleBuffer();
119
124 void setBorder( int newValue );
125
129 int getBorderSize();
130
134 SbBool isBorder() const;
135
140 void setDrawToFrontBufferEnable( SbBool enableFlag );
141
145 SbBool isDrawToFrontBufferEnable() const;
146
160 void setFloatingColorBuffer( SbBool enable, FloatColorBufferSize size = FLOAT_16_COLOR_BUFFER );
161
166 void getFloatingColorBuffer( SbBool& enable, FloatColorBufferSize& size );
167
171 static SbBool isFloatingColorBufferSupported();
172
178 void setGLModes( int mode );
179
183 int getGLModes() const;
184
192 SbBool setGLFormat( const SoGLFormat& format );
193
197 const SoGLFormat& getGLFormat() const;
198
204 typedef SbBool (*FormatChangeCallback)( SoGLFormat&, void* userData );
205
210 void setOnFormatChangeCalback( FormatChangeCallback callback, void* userData = NULL );
211
219 virtual SbBool setDoubleBuffer( SbBool enable );
220
224 void setRemoteRendering( bool enable );
225
229 bool isRemoteRendering() const;
230
235 SbBool setStereoEnabled( SbBool enable );
236
240 SbBool isStereoEnabled() const;
241
244 // Note: It would make more sense to copydoc *from* this class, but
245 // Doxygen won't do that because this class is not currently documented... :-(
246 bool saveSnapshot( const SbString& filename, bool override = true );
247
248 // Accessor and mutator for the member m_drawToFrontBuffer
249 void setDrawToFrontBuffer( SbBool enable );
250 SbBool getDrawToFrontBuffer() const;
251
252 // Accessor and mutator for the member m_colorMap
253 void setColorMap( unsigned long colorMap );
254 unsigned long getColorMap() const;
255
256 // ----------------------- Extension usage -----------------------------------
257
258 // sets/gets the size of the glx widget(s) - Note this size could be
259 // different from the SoXtComponent::getSize() method which return
260 // the size of the component, not necessary the same as the glx widget
261 // window (because of extra stuff like the decoration in the viewers).
262 void setGlxSize( SbVec2s newSize );
263 const SbVec2s& getGlxSize() const;
264
265 SbBool isStereoBuffer();
266
267 // returns TRUE if main window is in rgb mode (FALSE if color index)
268 SbBool isRGBMode();
269
270 // return the graphic config template from field gcTemplate.
271 void setGraphicConfigTemplate( SoGLGraphicConfigTemplate* gc );
272 SoGLGraphicConfigTemplate* getGraphicConfigTemplate();
273
274 // setup system dependent GLWidget handles.
275 void setGLWidgetHandle( const void* glWidgetHandle,
276 soGUIDependentCB swapBufferCB,
277 soGUIDependentCB bindCurrentCB,
278 soGUIDependentCB unbindCurrentCB,
279 soGUIWindowDependentCB getNormalCB,
280 soGUIWindowDependentCB getDisplayCB = NULL);
281
282 // These call are internal public to let IvTune to access them.
283 // handle on GLWidget handle/function comming from system independent GUI
284 // initialized through setGLWidgetHandle;
285 static soGUIDependentCB swapNormalBuffersCB;
286 static soGUIDependentCB bindNormalCurrentCB;
287 static soGUIDependentCB unbindNormalCurrentCB;
288 static soGUIWindowDependentCB getNormalWindowCB;
289 static soGUIWindowDependentCB getCurrentDisplayCB;
290 void * m_glWidgetHandle;
291
292 virtual void* getNormalWindow() { return getNormalWindowCB(m_glWidgetHandle); }
293 virtual void* getDisplay() { return getCurrentDisplayCB(m_glWidgetHandle); }
294
295 virtual SbBool bindNormalContext();
296 virtual SbBool unbindNormalContext();
297
298 bool onAntialiasingSwitch(const SoSceneManager::AntialiasingMode& mode, const float& quality, const SoAntialiasingParameters* parameters);
299
300
301
302private:
303
307 virtual ~SoGuiGLWidget();
308
309 static SbBool m_hasFloatBuffer;
310
311 SiAntialiasingEventListener* getAntialiasingListener() const;
312
313// ----------------------- Private usage -------------------------------------
314
315private:
316
317 // Used by deprecated Antialiasing API
318 SoAntialiasingParameters* m_fsaaParameters;
319
320 // local vars
321 SbVec2s m_glxSize; // size of glx widgets which is always up to date
322 int m_glModes;
323 int m_borderSize;
324
325 SoGLFormat m_format;
326 FormatChangeCallback m_formatChangeCallback;
327 void* m_formatChangeCallbackUserData;
328
329 unsigned long m_colorMap; // set when color index is used
330 int m_colorMapSize;
331
332 SbBool m_drawToFrontBuffer; // used by RA to draw new scenes to front buffer
333 SbBool m_enableDrawToFrontBuffer;
334
335 unsigned long m_transparentPixel;
336
337 bool m_isRemoteRendering;
338
339 int m_snapshotFBOId;
340
341 SbBool m_isFloatingPointRendering;
342 FloatColorBufferSize m_floatingPointRenderingPrecision;
343
344 SoGLGraphicConfigTemplate* m_gcTemplate;
345
346 SiAntialiasingEventListener* m_antialiasingListener;
347};
348
349
350#endif // SO_GUI_GL_WIDGET_H
351
352
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:700
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Antialiasing cha...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Antialiasing par...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL pixel for...
Definition SoGLFormat.h:55
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Defines an OpenG...
Field containing a single Boolean value.
Definition SoSFBool.h:79
AntialiasingMode
Enum which indicates the desired antialiasing algorithm.
@ AUTO
This is the default mode for antialiasing.
int SbBool
Boolean type.
Definition SbBase.h:87