Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
RenderArea.h
Go to the documentation of this file.
1#ifndef RenderArea_H
2#define RenderArea_H
3
4#include <Inventor/sys/port.h>
5
6#if defined(_WIN32) && !defined(OIV_DISABLE_AUTOLINK) && !defined(QtViewerComponents_EXPORTS)
7# if !defined(__QT_VIEWER_COMPONENTS_LIB)
8# if defined(_DEBUG)
9# define __QT_VIEWER_COMPONENTS_LIB "fei_inventor_QtViewerComponentsD.lib"
10# else
11# define __QT_VIEWER_COMPONENTS_LIB "fei_inventor_QtViewerComponents.lib"
12# endif
13# endif
14# pragma comment(lib, __QT_VIEWER_COMPONENTS_LIB)
15#endif
16
17#include <QWindow>
18
19#include <Inventor/misc/SoRef.h>
20#include <Inventor/sys/SoGL.h>
24
25#include <Inventor/sys/port.h>
26
27class SoNode;
28class QOpenGLPaintDevice;
29
46{
47public:
51 RenderArea( QWidget* parent );
52
54 virtual ~RenderArea();
55
59 virtual void setSceneGraph( SoNode* sceneGraph );
60
64 virtual SoNode* getSceneGraph() const;
65
70 virtual void setClearPolicy( ClearPolicy policy );
71
75 virtual ClearPolicy getClearPolicy() const;
76
81 virtual void setClearColor( const SbColorRGBA& color );
82
86 virtual SbColorRGBA getClearColor() const;
87
92 virtual void setClearDepth( float depth );
93
97 virtual float getClearDepth() const;
98
102 virtual void setSize( const SbVec2i32& size );
103
107 virtual SbVec2i32 getSize() const;
108
112 virtual void setGLRenderAction( SoGLRenderAction* glAction );
113
119
125
130
136
141
147 virtual void setAntialiasingQuality( float quality ) override;
148
152 virtual float getAntialiasingQuality() const override;
153
161 virtual void setStillSuperSamplingQuality( float quality ) override;
162
166 virtual float getStillSuperSamplingQuality() const override;
167
175 virtual void setStillSuperSamplingDelay( unsigned int delay ) override;
176
180 virtual unsigned int getStillSuperSamplingDelay() const override;
181
186
190 virtual void activateStereo( bool activated );
191
198 virtual bool isStereoActivated() const;
199
206 virtual void setStereoParameters( SoStereoParameters* parameters );
207
212
217
218 QWidget*
220 {
221 return m_containerWidget;
222 }
223
224private:
231 virtual RenderStatus render();
232
236 virtual bool event( QEvent* e );
237
243 virtual void initializeGL();
244
252 virtual void resizeEvent( QResizeEvent* e );
253
257 virtual void exposeEvent( QExposeEvent* e );
258
259private:
264 SoRef<SoRenderAreaCore> m_renderAreaCore;
265
267 SoNode* m_sceneGraph;
268 ClearPolicy m_clearPolicy;
269 SbColorRGBA m_color;
270 float m_depth;
271 SbVec2i32 m_size;
272 bool m_stereo;
273
274
276 SoGLRenderAction* m_glRenderAction;
277
281 SoGLRenderAction::TransparencyType m_transparencyType;
282
286 SoSceneManager::AntialiasingMode m_antialiasingMode;
287
291 float m_antialiasingQuality;
292
296 unsigned int m_stillAntialiasingDelay;
297
301 float m_stillAntialiasingQuality;
302
304 QWidget* m_containerWidget;
305
307 struct RenderAreaSaveRestore
308 {
309 RenderAreaSaveRestore();
310 virtual ~RenderAreaSaveRestore();
312 SbVec2i32 m_previousRenderingSize;
314 GLuint m_backupFBOId;
316 GLuint m_colorTextureId;
318 GLuint m_depthStencilTextureId;
320 SoRef<SoGLContext> m_context;
321 };
322
323#if 1 SoDEPRECATED
326 void saveRenderArea() {}
327SoDEPRECATED
330 void restoreRenderArea() {}
331#endif
333private:
334 void init();
335
336 bool m_needInitGL;
337 SoRef<SoGLContext> m_context;
338 QOpenGLContext* m_qtContext;
339 QOpenGLPaintDevice* m_device;
340};
341
342#endif // RenderArea_H
unsigned int GLuint
Definition SoGLType.h:28
static void init()
Class to render an OpenInventor scene in a Qt OpenGL window.
Definition RenderArea.h:46
virtual SbColorRGBA getClearColor() const
Gets the RGBA value used when the color buffer is cleared.
virtual void setAntialiasingMode(SoSceneManager::AntialiasingMode mode) override
Define the antialiasing mode.
virtual void setAntialiasingQuality(float quality) override
Define the antialiasing quality value.
bool isRawStereoAvailable()
Returns true if stereo buffering is enabled.
virtual void setStillSuperSamplingDelay(unsigned int delay) override
Set delay for supersampling when "still" (not interacting).
virtual void setGLRenderAction(SoGLRenderAction *glAction)
Defines the render action used for rendering.
virtual void setSceneGraph(SoNode *sceneGraph)
Sets the scene graph to render.
QWidget * getContainerWidget()
Definition RenderArea.h:219
virtual void setStillSuperSamplingQuality(float quality) override
Set quality for supersampling when "still" (not interacting).
virtual void setTransparencyType(SoGLRenderAction::TransparencyType type)
Sets the global transparency algorithm to use when rendering.
RenderArea(QWidget *parent)
This constructor initializes the QOpenGLWidget using the default QSurfaceFormat.
virtual void activateStereo(bool activated)
Activate/Deactivate stereo.
virtual SbEventHandler< RenderEventArg & > & onStartRender()
Returns the event handler that raises when a new render starts.
virtual SoGLRenderAction::TransparencyType getTransparencyType() const
Gets the global transparency algorithm to use when rendering.
virtual SoNode * getSceneGraph() const
Gets the scene graph to render.
virtual unsigned int getStillSuperSamplingDelay() const override
virtual ClearPolicy getClearPolicy() const
Gets the color buffer and depth buffer clear policy.
virtual SbVec2i32 getSize() const
Gets the size used for rendering.
virtual SoGLRenderAction * getGLRenderAction() const
Returns the render action used for rendering.
virtual SoSceneManager::AntialiasingMode getAntialiasingMode() const override
virtual void setClearColor(const SbColorRGBA &color)
Defines the RGBA value used when the color buffer is cleared.
virtual float getStillSuperSamplingQuality() const override
virtual void setClearPolicy(ClearPolicy policy)
Defines the color buffer and depth buffer clear policy.
virtual float getAntialiasingQuality() const override
virtual SoStereoParameters * getStereoParameters() const
virtual void setClearDepth(float depth)
Defines the depth value used when the depth buffer is cleared.
virtual ~RenderArea()
Destructor.
virtual void setStereoParameters(SoStereoParameters *parameters)
Defines the stereo parameters.
virtual float getClearDepth() const
Gets the depth value used when the depth buffer is cleared.
virtual void setSize(const SbVec2i32 &size)
Defines the size used for rendering.
virtual bool isStereoActivated() const
Returns true if stereo rendering is currently activated.
ColorRGBA vector class.
Definition SbColorRGBA.h:61
Class representing an event.
2D vector class.
Definition SbVec.h:517
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea antia...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea inter...
ClearPolicy
Policy values to clear color and depth buffers beforing rendering.
virtual RenderStatus render()=0
Render the managed scene graph (see setSceneGraph).
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea stere...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea still...
Renders a scene graph using Open Inventor's Render Engine.
TransparencyType
Transparency rendering algorithm.
Abstract base class for all database nodes.
Definition SoNode.h:145
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
AntialiasingMode
Enum which indicates the desired antialiasing algorithm.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Stereo parameter...
size_t size() const
#define QTVIEWERCOMPONENTS_API
Definition port.h:387