Component for rendering Open Inventor scene graphs. More...
#include <Inventor/Qt/SoQtRenderArea.h>
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
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.
SbColor SoQtRenderArea::getBackgroundColor | ( | ) | const [inline] |
Gets the background color for this window.
int SoQtRenderArea::getBackgroundIndex | ( | ) | const [inline] |
Gets the window background color when in color index mode.
static uint32_t SoQtRenderArea::getDefaultRedrawPriority | ( | ) | [inline, static] |
Gets the default priority number of the redraw sensor.
SoGLRenderAction::FastEditSavePolicy SoQtRenderArea::getFastEditSavePolicy | ( | ) | const [inline] |
Returns fast editing save policy used when rendering.
void SoQtRenderArea::getFloatingColorBuffer | ( | SbBool & | enable, | |
FloatColorBufferSize & | size | |||
) |
Returns TRUE if floating point rendering is used and its precision.
SoGLRenderAction* SoQtRenderArea::getGLRenderAction | ( | ) | const [inline] |
Gets the current GL render action.
SoGLRenderAction::InvalidateCacheMode SoQtRenderArea::getInvalidateCacheMode | ( | ) |
Returns the current cache invalidation mode.
virtual SoMPEGRenderer* SoQtRenderArea::getMPEGRecorder | ( | ) | const [inline, virtual] |
Returns the recorder used for MPEG encoding.
SoQtRenderAreaRenderCB* SoQtRenderArea::getPostRenderCallback | ( | const void *& | userData | ) | const [inline] |
Gets the post-render callback function and data.
Returns NULL if no callback has been specified by the application.
uint32_t SoQtRenderArea::getRedrawPriority | ( | ) | const [inline] |
Gets the priority of the redraw sensor.
virtual SoNode* SoQtRenderArea::getSceneGraph | ( | ) | [virtual] |
Gets the scene graph to be rendered in this component's window.
Reimplemented in SoQtViewer.
SoSceneManager* SoQtRenderArea::getSceneManager | ( | ) | const [inline] |
Gets the normal scene manager.
Note: For convenience most of the SoSceneManager methods have already been added to this class.
const SbGLShareContext SoQtRenderArea::getShareContext | ( | ) |
Returns the information needed to make OpenGL render contexts share OpenGL objects, for example, display lists and texture objects.
SoGLRenderAction::TransparencyType SoQtRenderArea::getTransparencyType | ( | ) | const [inline] |
Gets the algorithm for rendering transparent objects.
See SoGLRenderAction for possible transparency types.
const SbViewportRegion& SoQtRenderArea::getViewportRegion | ( | ) | const [inline] |
Gets current viewport region to use for rendering.
SbBool SoQtRenderArea::isAutoRedraw | ( | ) | const [inline] |
Queries whether the render area will automatically redraw whenever something in the scene graph changes.
SbBool SoQtRenderArea::isClearBeforeRender | ( | ) | const [inline] |
Queries whether the window will be cleared before rendering starts.
SbBool SoQtRenderArea::isClearZBufferBeforeRender | ( | ) | const [inline] |
Queries whether the depth buffer (sometimes called the Z buffer) will be cleared before rendering starts.
static SbBool SoQtRenderArea::isFloatingColorBufferSupported | ( | ) | [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.
void SoQtRenderArea::render | ( | ) | [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).
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.
void SoQtRenderArea::setBackgroundIndex | ( | int | index | ) | [inline] |
Sets the window background color when in color index mode.
Default is black (index 0)).
void SoQtRenderArea::setClearBeforeRender | ( | SbBool | trueOrFalse, | |
SbBool | zbTrueOrFalse = TRUE | |||
) | [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.
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.
virtual void SoQtRenderArea::setMPEGRecorder | ( | SoMPEGRenderer * | recorder | ) | [inline, virtual] |
Sets the recorder used for MPEG encoding.
recorder | the recorder to be used. |
void SoQtRenderArea::setPostRenderCallback | ( | SoQtRenderAreaRenderCB * | fcn, | |
void * | userData = NULL | |||
) | [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).
void SoQtRenderArea::setRedrawPriority | ( | uint32_t | priority | ) | [inline] |
Sets the priority of the redraw sensor.
virtual void SoQtRenderArea::setSceneGraph | ( | SoNode * | newScene | ) | [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.
void SoQtRenderArea::setViewportRegion | ( | const SbViewportRegion & | newRegion | ) | [inline] |
Sets viewport region to use for rendering.
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.