Component for rendering Open Inventor scene graphs. More...
#include <Inventor/Qt/SoQtRenderArea.h>
Public Member Functions | |
SoQtRenderArea (QWidget *parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SbBool getMouseInput=TRUE, SbBool getKeyboardInput=TRUE) | |
Constructor which is passed arguments which tell it whether to register the mouse and keyboard devices by default (SoQtMouse and SoQtKeyboard). | |
~SoQtRenderArea () | |
Destructor. | |
virtual void | setSceneGraph (SoNode *newScene) |
Sets the scene graph to be rendered in this component's window. | |
virtual SoNode * | getSceneGraph () |
Gets the scene graph to be rendered in this component's window. | |
void | registerDevice (SoQtDevice *d) |
Registers interest in devices. | |
void | unregisterDevice (SoQtDevice *d) |
Unregisters interest in devices. | |
void | setBackgroundColor (const SbColor &c) |
Sets the background color for this window. | |
SbColor | getBackgroundColor () const |
Gets the background color for this window. | |
void | setBackgroundIndex (int index) |
Sets the window background color when in color index mode. | |
int | getBackgroundIndex () const |
Gets the window background color when in color index mode. | |
void | setColorMap (QGLColormap *cmap) |
Sets the colors to use when displaying in color index mode. | |
void | setViewportRegion (const SbViewportRegion &newRegion) |
Sets viewport region to use for rendering. | |
const SbViewportRegion & | getViewportRegion () const |
Gets current viewport region to use for rendering. | |
void | setTransparencyType (SoGLRenderAction::TransparencyType type) |
Sets the algorithm for rendering transparent objects. | |
SoGLRenderAction::TransparencyType | getTransparencyType () const |
Gets the algorithm for rendering transparent objects. | |
void | setFastEditSavePolicy (SoGLRenderAction::FastEditSavePolicy policy, SbBool fastEditDelayedObjects=FALSE) |
Sets fast editing save policy to use when rendering. | |
SoGLRenderAction::FastEditSavePolicy | getFastEditSavePolicy () const |
Returns fast editing save policy used when rendering. | |
void | setInvalidateCacheMode (SoGLRenderAction::InvalidateCacheMode icm) |
Enables or disables the invalidation of render caches. | |
SoGLRenderAction::InvalidateCacheMode | getInvalidateCacheMode () |
Returns the current cache invalidation mode. | |
void | setClearBeforeRender (SbBool trueOrFalse, SbBool zbTrueOrFalse=TRUE) |
Enables/prevents window clearing from happening before a rendering starts (default is clear TRUE). | |
SbBool | isClearBeforeRender () const |
Queries whether the window will be cleared before rendering starts. | |
SbBool | isClearZBufferBeforeRender () const |
Queries whether the depth buffer (sometimes called the Z buffer) will be cleared before rendering starts. | |
void | setAutoRedraw (SbBool trueOrFalse) |
The render area will automatically redraw whenever something in the scene graph changes. | |
SbBool | isAutoRedraw () const |
Queries whether the render area will automatically redraw whenever something in the scene graph changes. | |
void | setRedrawPriority (uint32_t priority) |
Sets the priority of the redraw sensor. | |
uint32_t | getRedrawPriority () const |
Gets the priority of the redraw sensor. | |
void | render () |
Calling this forces the render area to be redrawn now. | |
void | scheduleRedraw () |
Schedules a redraw to happen sometime soon (as opposed to immediately). | |
void | redrawOnSelectionChange (SoSelection *s) |
Call this convenience method to have this render area redraw whenever the selection list changes in the passed node. | |
void | setEventCallback (SoQtRenderAreaEventCB *fcn, void *userData=NULL) |
Windows messages which occur in the render area window are either directly handled by the viewer (when this is really a viewer) or automatically translated to SoEvents, then passed into the scene graph (via the SoHandleEventAction) so that live scene graph objects can handle the message (when viewers are not in viewing mode). | |
void | setSceneManager (SoSceneManager *sm) |
Sets the normal scene manager. | |
SoSceneManager * | getSceneManager () const |
Gets the normal scene manager. | |
void | setGLRenderAction (SoGLRenderAction *ra) |
Sets the GL render action to use. | |
SoGLRenderAction * | getGLRenderAction () const |
Gets the current GL render action. | |
const SbGLShareContext | getShareContext () |
Returns the information needed to make OpenGL render contexts share OpenGL objects, for example, display lists and texture objects. | |
void | setPostRenderCallback (SoQtRenderAreaRenderCB *fcn, void *userData=NULL) |
Specifies a function to be called after the Open Inventor render traversal and immediately before the OpenGL buffer swap. | |
SoQtRenderAreaRenderCB * | getPostRenderCallback (const void *&userData) const |
Gets the post-render callback function and data. | |
void | setFloatingColorBuffer (SbBool enable, FloatColorBufferSize size=FLOAT_16_COLOR_BUFFER) |
Enables/disables floating point rendering using 16- or 32-bit components. | |
void | getFloatingColorBuffer (SbBool &enable, FloatColorBufferSize &size) |
Returns TRUE if floating point rendering is used and its precision. | |
void | sendEvent (QEvent *anEvent) |
Sends the event to be processed by the renderArea. | |
virtual void | setMPEGRecorder (SoMPEGRenderer *recorder) |
Sets the recorder used for MPEG encoding. | |
virtual SoMPEGRenderer * | getMPEGRecorder () const |
Returns the recorder used for MPEG encoding. | |
Public Member Functions inherited from SoQtGLWidget | |
int | getColorMapSize () |
Returns the color map size. | |
void | setColorMapSize (int size) |
Sets the color map size. | |
virtual WindowQt | getNormalWindow () |
Gets the normal GL window (window system identifier of the widget), which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes. | |
QOpenGLContext * | getQOpenGLContext () |
Gets the current context, which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes. | |
SoGLContext * | getNormalSoContext () |
Gets the current context, which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes. | |
QWidget * | getNormalWidget () |
Gets the current normal widget. | |
QSurfaceFormat | getQSurfaceFormat () |
Returns the QSurfaceFormat currently used. | |
virtual void | setNormalVisual (QSurfaceFormat vis) |
Sets the visual/pixel format for the normal window. | |
virtual void | setNormalVisual (const SoGLFormat &format) |
Sets the visual/pixel format for the normal window. | |
virtual void | show () |
This shows the component. | |
virtual void | hide () |
This hides the component. | |
virtual void | setDoubleBuffer (SbBool onOrOff) |
Routine that dynamically changes between single and double buffering. | |
SbBool | isDoubleBuffer () |
Returns whether double buffering is on or off. | |
void | setBorder (SbBool onOrOff) |
Included for portability only. | |
int | getBorderSize () |
Included for portability only. | |
SbBool | isBorder () const |
Included for portability only. | |
void | setDrawToFrontBufferEnable (SbBool enableFlag) |
Sets drawing to the front buffer. | |
SbBool | isDrawToFrontBufferEnable () const |
Queries drawing to the front buffer. | |
virtual SbBool | bindNormalContext () |
Makes the normal rendering context the current context. | |
virtual SbBool | unbindNormalContext () |
unbind the current context (previously bind with bindNormalContext ); | |
virtual SbBool | swapNormalBuffers () |
Swaps the normal front and back buffers. | |
virtual void | setCursor (const QCursor &newCursor) |
Sets the current cursor. | |
QCursor | getCursor () const |
Returns the current cursor. | |
void | setAntialiasing (const float quality, const SoSceneManager::AntialiasingMode mode=SoSceneManager::AUTO) |
Enable (or disable) antialiasing with specified quality and mode. | |
void | setAntialiasing (SoAntialiasingParameters *advancedParameters) |
Enable (or disable) antialiasing with specific parameters. | |
float | getAntialiasingQuality () const |
Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method. | |
SoSceneManager::AntialiasingMode | getAntialiasingMode () const |
Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method. | |
SoAntialiasingParameters * | getAntialiasingParameters () const |
Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method. | |
bool | saveSnapshot (const SbString &filename, bool overwrite=true) |
Save a snapshot of the current image displayed in the viewer. | |
Public Member Functions inherited from SoQtComponent | |
SbBool | isVisible () |
Returns TRUE if this component is mapped onto the screen. | |
virtual QWidget * | getWidget () const |
This returns the base widget handle for this component. | |
SbBool | isTopLevelShell () const |
Returns TRUE if this component is a top level shell component (has its own window). | |
QWidget * | getShellWidget () const |
Returns the topLevelShell widget handle (NULL if the topLevelShell hasn't been created by this component). | |
QWidget * | getParentWidget () const |
Returns the parent widget handle. | |
void | setSize (const SbVec2s &size) |
Convenience routine on the widget handle. | |
SbVec2s | getSize () |
Convenience routine on the widget handle. | |
virtual SbBool | setFullScreen (const SbBool enable) |
Switches the viewer into (or out of) fullscreen mode. | |
SbBool | isFullScreen (void) const |
Queries if the viewer is in fullscreen mode. | |
void | setFullScreenEnable (const SbBool enable) |
Enables/disables fullscreen mode. | |
SbBool | isFullScreenEnable (void) const |
Queries if it is possible to put the viewer in fullscreen mode. | |
SbGlContextHelper::Display | getDisplay () |
On UNIX, returns the X display associated with this components widget. | |
void | setTitle (const char *newTitle) |
Sets window title. | |
void | setTitle (const SbString &newTitle) |
Sets window title. | |
void | setTitle (const QString &newTitle) |
Sets window title. | |
const QString | getTitle () const |
Gets window title. | |
void | setIconTitle (const QString &newIconTitle) |
Included for portability only. | |
const QString | getIconTitle () const |
Included for portability only. | |
SbString | getWidgetName () const |
Returns the widget handle name. | |
SbString | getClassName () const |
Returns the class name. | |
void | setWindowCloseCallback (SoQtComponentCB *func, void *data=NULL) |
Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is set to something other than NULL. | |
Static Public Member Functions | |
static uint32_t | getDefaultRedrawPriority () |
Gets the default priority number of the redraw sensor. | |
static SbBool | isFloatingColorBufferSupported () |
Returns TRUE if floating point rendering is available. | |
Static Public Member Functions inherited from SoQtComponent | |
static SoQtComponent * | getComponent (QWidget *widget) |
Returns the SoQtComponent for this widget handle. | |
Additional Inherited Members | |
Public Types inherited from SoQtGLWidget | |
enum | FloatColorBufferSize { FLOAT_16_COLOR_BUFFER = SoGuiGLWidget::FLOAT_16_COLOR_BUFFER , FLOAT_32_COLOR_BUFFER = SoGuiGLWidget::FLOAT_32_COLOR_BUFFER } |
FloatColorBufferSize. More... | |
Public Attributes inherited from SoQtComponent | |
SbString | helpFileName |
Name of help file to open when the viewer Help button is pressed. | |
Component for rendering Open Inventor scene graphs.
This class provides Open Inventor rendering and event handling inside a QT widget. There is a routine to specify the scene to render. The scene is automatically rendered whenever anything under it changes (a data sensor is attached to the root of the scene), unless explicitly told not to do so (manual redraws). Users can also set Open Inventor rendering attributes such as the transparency algorithm, antialiasing on or off, etc. This class employs an SoSceneManager to manage rendering and event handling.
Q events that occur in the render area can be handled by the application, by the viewer (if this is really a viewer), or by the nodes in the scene graph. When a event occurs, it is first passed to the application event callback function registered with the setEventCallback() method on SoQtRenderArea. If this function does not exist or returns FALSE, the Q event is either used directly by the viewer or translated to an SoEvent for further scene graph processing. If the viewer does not handle the event, the SoEvent is sent to main scene graph by way of an SoHandleEventAction.
*SoQtRenderArea*BackgroundColor: black (color name or hex value)
SoQtGLWidget, SoQtComponent, SoQtViewer, SoSceneManager, SoBoxHighlightRenderAction, SoLineHighlightRenderAction
Definition at line 101 of file SoQtRenderArea.h.
SoQtRenderArea::SoQtRenderArea | ( | QWidget * | parent = NULL , |
const char * | name = NULL , |
||
SbBool | buildInsideParent = TRUE , |
||
SbBool | getMouseInput = TRUE , |
||
SbBool | getKeyboardInput = TRUE |
||
) |
Constructor which is passed arguments which tell it whether to register the mouse and keyboard devices by default (SoQtMouse and SoQtKeyboard).
SoQtRenderArea::~SoQtRenderArea | ( | ) |
Destructor.
|
inline |
Gets the background color for this window.
Definition at line 156 of file SoQtRenderArea.h.
|
inline |
Gets the window background color when in color index mode.
Definition at line 167 of file SoQtRenderArea.h.
|
inlinestatic |
Gets the default priority number of the redraw sensor.
Definition at line 293 of file SoQtRenderArea.h.
|
inline |
Returns fast editing save policy used when rendering.
Definition at line 219 of file SoQtRenderArea.h.
void SoQtRenderArea::getFloatingColorBuffer | ( | SbBool & | enable, |
FloatColorBufferSize & | size | ||
) |
Returns TRUE if floating point rendering is used and its precision.
|
inline |
Gets the current GL render action.
Definition at line 362 of file SoQtRenderArea.h.
SoGLRenderAction::InvalidateCacheMode SoQtRenderArea::getInvalidateCacheMode | ( | ) |
Returns the current cache invalidation mode.
|
inlinevirtual |
Returns the recorder used for MPEG encoding.
Definition at line 437 of file SoQtRenderArea.h.
|
inline |
Gets the post-render callback function and data.
Returns NULL if no callback has been specified by the application.
Definition at line 392 of file SoQtRenderArea.h.
|
inline |
Gets the priority of the redraw sensor.
Definition at line 288 of file SoQtRenderArea.h.
|
virtual |
Gets the scene graph to be rendered in this component's window.
Reimplemented in SoQtViewer.
|
inline |
Gets the normal scene manager.
Note: For convenience most of the SoSceneManager methods have already been added to this class.
Definition at line 346 of file SoQtRenderArea.h.
const SbGLShareContext SoQtRenderArea::getShareContext | ( | ) |
Returns the information needed to make OpenGL render contexts share OpenGL objects, for example, display lists and texture objects.
|
inline |
Gets the algorithm for rendering transparent objects.
See SoGLRenderAction for possible transparency types.
Definition at line 202 of file SoQtRenderArea.h.
|
inline |
Gets current viewport region to use for rendering.
Definition at line 184 of file SoQtRenderArea.h.
|
inline |
Queries whether the render area will automatically redraw whenever something in the scene graph changes.
Definition at line 278 of file SoQtRenderArea.h.
|
inline |
Queries whether the window will be cleared before rendering starts.
Definition at line 257 of file SoQtRenderArea.h.
|
inline |
Queries whether the depth buffer (sometimes called the Z buffer) will be cleared before rendering starts.
Definition at line 263 of file SoQtRenderArea.h.
|
static |
Returns TRUE if floating point rendering is available.
void SoQtRenderArea::redrawOnSelectionChange | ( | SoSelection * | s | ) |
Call this convenience method to have this render area redraw whenever the selection list changes in the passed node.
This is useful if using a highlight render action like the SoBoxHighlightRenderAction to correctly render whenever the selection changes. Pass NULL to turn this off.
This call increases the ref counter of the given SoSelection node, it will be automatically decreased when the selection node is replaced by another one, or if it is turned off.
void SoQtRenderArea::registerDevice | ( | SoQtDevice * | d | ) |
Registers interest in devices.
When a device is registered, messages from that device will be processed by the render area, and passed into the scene graph. Messages from unregistered devices will be ignored.
|
inline |
Calling this forces the render area to be redrawn now.
It is not necessary to call this method if auto redraw is enabled (which is the default).
Definition at line 299 of file SoQtRenderArea.h.
void SoQtRenderArea::scheduleRedraw | ( | ) |
Schedules a redraw to happen sometime soon (as opposed to immediately).
This can be used to compress multiple redraws.
void SoQtRenderArea::sendEvent | ( | QEvent * | anEvent | ) |
Sends the event to be processed by the renderArea.
void SoQtRenderArea::setAutoRedraw | ( | SbBool | trueOrFalse | ) |
The render area will automatically redraw whenever something in the scene graph changes.
Passing FALSE will disable this feature. NOTE: the render area will always redraw in response to window system events (e.g. resize, exposure) regardless of the setting of the auto redraw flag.
void SoQtRenderArea::setBackgroundColor | ( | const SbColor & | c | ) |
Sets the background color for this window.
Default is black (0,0,0).
The default value can be set using the environment variable OIV_BACKGROUND_COLOR. Specify three floats (R, G, B) in the range 0. to 1.,
separated by spaces.
|
inline |
Sets the window background color when in color index mode.
Default is black (index 0)).
Definition at line 162 of file SoQtRenderArea.h.
|
inline |
Enables/prevents window clearing from happening before a rendering starts (default is clear TRUE).
This can be useful to limit flickering when doing single buffering and geometry covers the entire window (used in the material editor). Also controls whether the depth buffer (sometimes called the Z buffer) is cleared before rendering.
Definition at line 251 of file SoQtRenderArea.h.
void SoQtRenderArea::setColorMap | ( | QGLColormap * | cmap | ) |
Sets the colors to use when displaying in color index mode.
This will load the color map with the given colors at the starting index.
void SoQtRenderArea::setEventCallback | ( | SoQtRenderAreaEventCB * | fcn, |
void * | userData = NULL |
||
) |
Windows messages which occur in the render area window are either directly handled by the viewer (when this is really a viewer) or automatically translated to SoEvents, then passed into the scene graph (via the SoHandleEventAction) so that live scene graph objects can handle the message (when viewers are not in viewing mode).
This method allows the application to register a callback for handling messages that occur in the window, instead of sending them to the viewers or down the graph. The callback is passed the Windows message, and should return TRUE if it handled the message. If the callback returns FALSE, then the message will be handled by the render area.
void SoQtRenderArea::setFastEditSavePolicy | ( | SoGLRenderAction::FastEditSavePolicy | policy, |
SbBool | fastEditDelayedObjects = FALSE |
||
) |
Sets fast editing save policy to use when rendering.
The default is WHEN_NEEDED. Valid values are DISABLE, EACH_FRAME, and WHEN_NEEDED. See SoSeparator.
If fastEditDelayedObjects is set to TRUE, delayed objects won't be redrawn when editing the scene graph. It means that composition between delayed transparent objects and the fast edit scene graph won't be correct but redrawing may be much faster. Default is false.
void SoQtRenderArea::setFloatingColorBuffer | ( | SbBool | enable, |
FloatColorBufferSize | size = FLOAT_16_COLOR_BUFFER |
||
) |
Enables/disables floating point rendering using 16- or 32-bit components.
If TRUE, Open Inventor will automatically render to an offscreen floating point buffer, and copy the resulting image to the screen.
To determine if floating point rendering was successfully enabled, use getFloatingColorBuffer, below.
Using floating point rendering can improve image quality, particularly when many objects are being blended, for example, in volume rendering. This is a convenience method as you could accomplish the same results setting up a graphic template.
void SoQtRenderArea::setGLRenderAction | ( | SoGLRenderAction * | ra | ) |
Sets the GL render action to use.
This is used for example to set selection highlighting with the SoBoxHighlightRenderAction, SoHaloHighlightRenderAction and SoLineHighlightRenderAction classes.
Note: Properties of the previous render action, for example transparency type, are not automatically copied to the new render action. The application must explicitly set the desired properties of the new render action.
void SoQtRenderArea::setInvalidateCacheMode | ( | SoGLRenderAction::InvalidateCacheMode | icm | ) |
Enables or disables the invalidation of render caches.
This method is useful to force all nodes to be visited during render traversal.
|
inlinevirtual |
Sets the recorder used for MPEG encoding.
recorder | the recorder to be used. |
Definition at line 431 of file SoQtRenderArea.h.
|
inline |
Specifies a function to be called after the Open Inventor render traversal and immediately before the OpenGL buffer swap.
Generally the application should not modify Open Inventor state in these callbacks, but they can be useful for special effects using OpenGL calls.
When the callback function is called, Open Inventor has completed normal rendering (including delayed transparent objects, multi-pass, etc), but no "end of frame" calls (glFlush, glFinish, SwapBuffers...) have been made. The function should return TRUE if "end of frame" handling has been done by the application (Open Inventor will do nothing in this case). If FALSE is returned, Open Inventor will do its normal end of frame calls (normally calling SwapBuffers).
Definition at line 385 of file SoQtRenderArea.h.
|
inline |
Sets the priority of the redraw sensor.
Definition at line 283 of file SoQtRenderArea.h.
|
virtual |
Sets the scene graph to be rendered in this component's window.
Reimplemented in SoQtViewer.
void SoQtRenderArea::setSceneManager | ( | SoSceneManager * | sm | ) |
Sets the normal scene manager.
Note: For convenience most of the SoSceneManager methods have already been added to this class.
void SoQtRenderArea::setTransparencyType | ( | SoGLRenderAction::TransparencyType | type | ) |
Sets the algorithm for rendering transparent objects.
Default is NO_SORT. See SoGLRenderAction for possible transparency types. See also SoGLRenderAction::TransparencyType.
Note: When using OPAQUE_FIRST, SORTED_OBJECT or SORTED_PIXEL transparency, the depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.
|
inline |
Sets viewport region to use for rendering.
Definition at line 178 of file SoQtRenderArea.h.
void SoQtRenderArea::unregisterDevice | ( | SoQtDevice * | d | ) |
Unregisters interest in devices.
When a device is registered, messages from that device will be processed by the render area, and passed into the scene graph. Messages from unregistered devices will be ignored.