Component for rendering Open Inventor scene graphs. More...
#include <Inventor/Win/SoWinRenderArea.h>
Public Member Functions | |
SoWinRenderArea (SoWidget 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 (SoWinMouse and SoWinKeyboard). | |
~SoWinRenderArea () | |
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 (SoWinDevice *d) |
Registers interest in devices. | |
void | unregisterDevice (SoWinDevice *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 (int startIndex, int num, const SbColor *colors) |
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 (unsigned long priority) |
Sets the priority of the redraw sensor. | |
unsigned long | 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 (SoWinRenderAreaEventCB *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 (SoWinRenderAreaRenderCB *fcn, void *userData=NULL) |
Specifies a function to be called after the Open Inventor render traversal and immediately before the OpenGL buffer swap. | |
SoWinRenderAreaRenderCB * | 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 (XAnyEvent *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 SoWinGLWidget | |
virtual Window | getNormalWindow () |
Gets the normal GL window, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes. | |
GLXContext | getNormalContext () |
Gets the normal context, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes. | |
virtual SoGLContext * | getNormalSoContext () |
Hdc | getNormalDC () const |
Returns the device context (which is needed for SbGlContextHelper::makeCurrent). | |
void | setStealFocus (SbBool onOrOff) |
By default the GLWidget "steals" focus whenever the cursor moves over it. | |
SoWidget | getNormalWidget () const |
Gets the normal window handle, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes. | |
virtual void | setNormalVisual (XVisualInfo *vis) |
Specifies the exact pixel format descriptor for the normal window. | |
XVisualInfo * | getNormalVisual () |
Returns the pixel format descriptor for the normal window. | |
virtual void | setPixelFormat (int format) |
Sets the current pixel format. | |
int | getPixelFormat () |
Returns the current pixel format. | |
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. | |
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 |
Returns whether drawing to the front buffer is enabled. | |
void | setCursor (Cursor newCursor) |
Sets the current cursor. | |
Cursor | getCursor () |
Returns the current cursor. | |
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. | |
SoGLGraphicConfigTemplate * | getGraphicConfigTemplate () |
Gets the current graphics configuration template. | |
void | setGraphicConfigTemplate (SoGLGraphicConfigTemplate *gTemplate) |
Sets a new graphics configuration template. | |
bool | saveSnapshot (const SbString &filename, bool overwrite=true) |
Save a snapshot of the current image displayed in the viewer. | |
Public Member Functions inherited from SoWinComponent | |
virtual void | show () |
This shows the component. | |
virtual void | hide () |
This hides the component. | |
SbBool | isVisible () |
Returns TRUE if this component is mapped onto the screen. | |
SoWidget | getWidget () const |
This returns the base window handle for this component. | |
SbBool | isTopLevelShell () const |
Returns TRUE if this component is a top level shell component (has its own window). | |
SoWidget | getShellWidget () const |
Returns the shell window handle (NULL if the shell hasn't been created by this component). | |
SoWidget | getParentWidget () const |
Returns the parent window handle, be it a shell or not. | |
void | setSize (const SbVec2s &size) |
Convenience routine on the window handle. | |
SbVec2s | getSize () |
Convenience routine on the window handle. | |
SbBool | setFullScreen (const SbBool enable) |
Switches the viewer into (or out of) fullscreen mode. | |
SbBool | isFullScreen () 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. | |
UINT * | getDisplay () |
Included for portability only. | |
SoNONUNICODE void | setTitle (const char *newTitle) |
Sets window title. | |
void | setTitle (const SbString &newTitle) |
Sets window title. | |
SbString | getTitle () const |
Gets window title. | |
SoNONUNICODE void | setIconTitle (const char *newIconTitle) |
Included for portability only. | |
void | setIconTitle (const SbString &newIconTitle) |
Included for portability only. | |
SbString | getIconTitle () const |
Included for portability only. | |
void | setWindowCloseCallback (SoWinComponentCB *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 specified. | |
SbString | getWidgetName () const |
Returns the window handle name. | |
SbString | getClassName () const |
Returns the class name. | |
virtual | ~SoWinComponent () |
Destructor. | |
Static Public Member Functions | |
static unsigned long | 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 SoWinComponent | |
SoDEPRECATED static SoNONUNICODE void | displayHelp (const char *filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoDEPRECATED void | displayHelp (const SbString &filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoWinComponent * | getComponent (SoWidget w) |
Returns the SoWinComponent for this window handle. | |
Additional Inherited Members | |
Public Types inherited from SoWinGLWidget | |
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 SoWinComponent | |
SbString | helpFileName |
Name of help file to open when the viewer Help button is pressed. | |
UINT | helpContextID |
The context ID of the help topic to open when the viewer Help button is pressed. | |
SbString | helpContextString |
The TopicID of the help topic to open when the viewer Help button is pressed. | |
Component for rendering Open Inventor scene graphs.
This class provides Open Inventor rendering and message handling inside a Windows window. 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 message handling.
Windows messages 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 message occurs, it is first passed to the application message callback function registered with the setEventCallback() method on SoWinRenderArea. If this function does not exist or returns FALSE, the message is either used directly by the viewer or translated to an SoEvent for further scene graph processing. If the viewer does not handle the message, the SoEvent is sent to the scene graph by way of an SoHandleEventAction.
SoWinGLWidget, SoWinComponent, SoWinViewer, SoSceneManager, SoBoxHighlightRenderAction, SoHaloHighlightRenderAction, SoLineHighlightRenderAction
Definition at line 109 of file SoWinRenderArea.h.
SoWinRenderArea::SoWinRenderArea | ( | SoWidget | 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 (SoWinMouse and SoWinKeyboard).
SoWinRenderArea::~SoWinRenderArea | ( | ) |
Destructor.
|
inline |
Gets the background color for this window.
Definition at line 169 of file SoWinRenderArea.h.
|
inline |
Gets the window background color when in color index mode.
Definition at line 180 of file SoWinRenderArea.h.
|
inlinestatic |
Gets the default priority number of the redraw sensor.
Definition at line 307 of file SoWinRenderArea.h.
|
inline |
Returns fast editing save policy used when rendering.
Definition at line 233 of file SoWinRenderArea.h.
|
virtual |
Returns TRUE if floating point rendering is used and its precision.
Reimplemented from SoWinGLWidget.
|
inline |
Gets the current GL render action.
Definition at line 402 of file SoWinRenderArea.h.
SoGLRenderAction::InvalidateCacheMode SoWinRenderArea::getInvalidateCacheMode | ( | ) |
Returns the current cache invalidation mode.
|
inlinevirtual |
Returns the recorder used for MPEG encoding.
Definition at line 464 of file SoWinRenderArea.h.
|
inline |
Gets the post-render callback function and data.
Returns NULL if no callback has been specified by the application.
Definition at line 433 of file SoWinRenderArea.h.
|
inline |
Gets the priority of the redraw sensor.
Definition at line 302 of file SoWinRenderArea.h.
|
virtual |
Gets the scene graph to be rendered in this component's window.
Reimplemented in SoWinViewer.
|
inline |
Gets the normal scene manager.
Note: For convenience most of the SoSceneManager methods have already been added to this class.
Definition at line 386 of file SoWinRenderArea.h.
const SbGLShareContext SoWinRenderArea::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 216 of file SoWinRenderArea.h.
|
inline |
Gets current viewport region to use for rendering.
Definition at line 198 of file SoWinRenderArea.h.
|
inline |
Queries whether the render area will automatically redraw whenever something in the scene graph changes.
Definition at line 292 of file SoWinRenderArea.h.
|
inline |
Queries whether the window will be cleared before rendering starts.
Definition at line 271 of file SoWinRenderArea.h.
|
inline |
Queries whether the depth buffer (sometimes called the Z buffer) will be cleared before rendering starts.
Definition at line 277 of file SoWinRenderArea.h.
|
static |
Returns TRUE if floating point rendering is available.
void SoWinRenderArea::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 SoHaloHighlightRenderAction 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 SoWinRenderArea::registerDevice | ( | SoWinDevice * | 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 313 of file SoWinRenderArea.h.
void SoWinRenderArea::scheduleRedraw | ( | ) |
Schedules a redraw to happen sometime soon (as opposed to immediately).
This can be used to compress multiple redraws.
void SoWinRenderArea::sendEvent | ( | XAnyEvent * | anEvent | ) |
Sends the event to be processed by the renderArea.
void SoWinRenderArea::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 SoWinRenderArea::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 (3 floats representing RGB values of the colors separated by space).
|
inline |
Sets the window background color when in color index mode.
Default is black (index 0)).
Definition at line 175 of file SoWinRenderArea.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 265 of file SoWinRenderArea.h.
void SoWinRenderArea::setColorMap | ( | int | startIndex, |
int | num, | ||
const SbColor * | colors | ||
) |
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 SoWinRenderArea::setEventCallback | ( | SoWinRenderAreaEventCB * | 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. In this case the message will not be handled by the viewer and will not be sent to the scene graph. If the callback returns FALSE, then the message will be handled by the view and/or sent to the scene graph.
The following Windows events are sent to setEventCallback:
void SoWinRenderArea::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 fast edit scene graph won't be correct but redrawing may be much faster. Default is FALSE.
|
virtual |
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.
Reimplemented from SoWinGLWidget.
void SoWinRenderArea::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 SoWinRenderArea::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.
Default is none.
recorder | the recorder to be used. |
Definition at line 458 of file SoWinRenderArea.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 425 of file SoWinRenderArea.h.
|
inline |
Sets the priority of the redraw sensor.
Definition at line 297 of file SoWinRenderArea.h.
|
virtual |
Sets the scene graph to be rendered in this component's window.
Reimplemented in SoWinViewer.
void SoWinRenderArea::setSceneManager | ( | SoSceneManager * | sm | ) |
Sets the normal scene manager.
Note: For convenience most of the SoSceneManager methods have already been added to this class.
void SoWinRenderArea::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 192 of file SoWinRenderArea.h.
void SoWinRenderArea::unregisterDevice | ( | SoWinDevice * | 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.