SoRenderManager Class Reference

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SoRenderManager Class Reference

## Public Types
enum | RenderMode { AS_IS, WIREFRAME, POINTS, WIREFRAME_OVERLAY, HIDDEN_LINE, BOUNDING_BOX }
enum | StereoMode { MONO, ANAGLYPH, SEPARATE_OUTPUT, QUAD_BUFFER = SEPARATE_OUTPUT, INTERLEAVED_ROWS, INTERLEAVED_COLUMNS }
enum | BufferType { BUFFER_SINGLE, BUFFER_DOUBLE }
enum | AutoClippingStrategy { NO_AUTO_CLIPPING, FIXED_NEAR_PLANE, VARIABLE_NEAR_PLANE }

## Public Member Functions
virtual void | render (const SbBool clearwindow=TRUE, const SbBool clearzbuffer=TRUE)
virtual void | render (SoGLRenderAction *action, const SbBool initmatrices=TRUE, const SbBool clearwindow=TRUE, const SbBool clearzbuffer=TRUE)
Superimposition * | addSuperimposition (SoNode *scene, uint32_t flags=Superimposition::AUTOREDRAW|Superimposition::ZBUFFERON|Superimposition::CLEARZBUFFER)
void | removeSuperimposition (Superimposition *s)
virtual void | setSceneGraph (SoNode *const sceneroot)
virtual SoNode * | getSceneGraph (void) const
void | setCamera (SoCamera *camera)
SoCamera * | getCamera (void) const
void | setAutoClipping (AutoClippingStrategy autoclipping)
void | attachRootSensor (SoNode *const sceneroot)
void | attachClipSensor (SoNode *const sceneroot)
void | detachRootSensor (void)
void | detachClipSensor (void)
AutoClippingStrategy | getAutoClipping (void) const
void | setNearPlaneValue (float value)
float | getNearPlaneValue (void) const
void | setTexturesEnabled (const SbBool onoff)
SbBool | isTexturesEnabled (void) const
void | setDoubleBuffer (const SbBool enable)
SbBool | isDoubleBuffer (void) const
void | setRenderMode (const RenderMode mode)
RenderMode | getRenderMode (void) const
void | setStereoMode (const StereoMode mode)
StereoMode | getStereoMode (void) const
void | setStereoOffset (const float offset)
float | getStereoOffset (void) const
void | setRenderCallback (SoRenderManagerRenderCB *f, void *const userData=NULL)
SbBool | isAutoRedraw (void) const
void | setRedrawPriority (const uint32_t priority)
uint32_t | getRedrawPriority (void) const
void | reinitialize (void)
void | scheduleRedraw (void)
void | setWindowSize (const SbVec2s &newsize)
const SbVec2s & | getWindowSize (void) const
void | setSize (const SbVec2s &newsize)
const SbVec2s & | getSize (void) const
void | setOrigin (const SbVec2s &newOrigin)
const SbVec2s & | getOrigin (void) const
void | setViewportRegion (const SbViewportRegion &newRegion)
const SbViewportRegion & | getViewportRegion (void) const
void | setBackgroundColor (const SbColor4f &color)
const SbColor4f & | getBackgroundColor (void) const
void | setBackgroundIndex (const int index)
int | getBackgroundIndex (void) const
void | setRGBMode (const SbBool onOrOff)
SbBool | isRGBMode (void) const
virtual void | activate (void)
virtual void | deactivate (void)
void | setAntialiasing (const SbBool smoothing, const int numPasses)
void | getAntialiasing (SbBool &smoothing, int &numPasses) const
void | setGLRenderAction (SoGLRenderAction *const action)
SoGLRenderAction * | getGLRenderAction (void) const
void | setAudioRenderAction (SoAudioRenderAction *const action)
SoAudioRenderAction * | getAudioRenderAction (void) const
void | addPreRenderCallback (SoRenderManagerRenderCB *cb, void *data)
void | removePreRenderCallback (SoRenderManagerRenderCB *cb, void *data)
void | addPostRenderCallback (SoRenderManagerRenderCB *cb, void *data)
void | removePostRenderCallback (SoRenderManagerRenderCB *cb, void *data)

## Static Public Member Functions
static void | nodesensorCB (void *data, SoSensor *)
static void | prerendercb (void *userdata, SoGLRenderAction *action)
static void | enableRealTimeUpdate (const SbBool flag)
static SbBool | isRealTimeUpdateEnabled (void)
static uint32_t | getDefaultRedrawPriority (void)

## Protected Member Functions
int | isActive (void) const
void | redraw (void)
void | renderScene (SoGLRenderAction *action, SoNode *scene, uint32_t clearmask)
void | actuallyRender (SoGLRenderAction *action, const SbBool initmatrices=TRUE, const SbBool clearwindow=TRUE, const SbBool clearzbuffer=TRUE)
void | renderSingle (SoGLRenderAction *action, SbBool initmatrices, SbBool clearwindow, SbBool clearzbuffer)
| Render once in correct draw style. More...
void | renderStereo (SoGLRenderAction *action, SbBool initmatrices, SbBool clearwindow, SbBool clearzbuffer)
| Render scene according to current stereo mode. More...
void | initStencilBufferForInterleavedStereo (void)
void | clearBuffers (SbBool color, SbBool depth)

## Detailed Description

Manages properties which influences how rendering is done.

## Member Enumeration Documentation

enum SoRenderManager::RenderMode

Sets how rendering of primitives is done.

Enumerator
AS_IS | Render primitives as they are described in the scenegraph.
WIREFRAME | Render only the wireframe
POINTS | Render only the vertices of the primitives
WIREFRAME_OVERLAY | Render a wireframe overlay in addition to the AS_IS mode
HIDDEN_LINE | As WIREFRAME, but culls lines which would otherwise not be shown due to geometric culling.
BOUNDING_BOX | Only show the bounding box of each object

enum SoRenderManager::StereoMode

Manages how to render steroscopic images.

Enumerator
MONO | No stereoscopic rendering
ANAGLYPH | Anaglyph rendering is used to provide a steroscopic 3D effect, when viewed with 3D glasses. The image is made up of two color layers which are superimposed on each other, and appears as 3 dimensional when viewed through corresponding colored filters(glases)
SEPARATE_OUTPUT | Send output to separate buffers.
QUAD_BUFFER | Same as SEPARATE_OUTPUT, SEPARATE_OUTPUT is more commonly known as QUAD_BUFFER, when also using double buffering.
INTERLEAVED_ROWS | Render every second row as left and right image. If rendered with a polarized projector, polarized filters kan be used to give a 3D effect.
INTERLEAVED_COLUMNS | Render every second column as left and right image. If rendered with a polarized projector, polarized filters kan be used to give a 3D effect.

enum SoRenderManager::BufferType

Buffering strategy

Enumerator
BUFFER_SINGLE | Output to one buffer
BUFFER_DOUBLE | Alternate between output buffers

enum SoRenderManager::AutoClippingStrategy

Strategy for adjusting camera clipping plane

Enumerator
NO_AUTO_CLIPPING | Turn off automatic clipping
FIXED_NEAR_PLANE | Keep near plane at a fixed distance from the camera
VARIABLE_NEAR_PLANE | Variable adjustment of the nearplane relative to the camera.

## Member Function Documentation

void SoRenderManager::render | ( | const SbBool | clearwindow = `TRUE`,
|  | const SbBool | clearzbuffer = `TRUE`
| ) |  |
| virtual

Render the scene graph.

All SbBool arguments should normally be `TRUE`, but they can be set to `FALSE` to optimize for special cases (e.g. when doing wireframe rendering one doesn't need a depth buffer).

Parameters

  [in] | clearwindow | If set to `TRUE`, clear the rendering buffer before drawing.
  [in] | clearzbuffer | If set to `TRUE`, clear the depth buffer values before rendering.

void SoRenderManager::render | ( | SoGLRenderAction * | action,
|  | const SbBool | initmatrices = `TRUE`,
|  | const SbBool | clearwindow = `TRUE`,
|  | const SbBool | clearzbuffer = `TRUE`
| ) |  |
| virtual

Render the scene graph.

All SbBool arguments should normally be `TRUE`, but they can be set to `FALSE` to optimize for special cases (e.g. when doing wireframe rendering one doesn't need a depth buffer).

Parameters

  [in] | clearwindow | If set to `TRUE`, clear the rendering buffer before drawing.
  [in] | clearzbuffer | If set to `TRUE`, clear the depth buffer values before rendering.
  [in] | initmatrices | if true, the projection and modelview matrices are reset to identity
  [in] | action | Renders with a user supplied action

SoRenderManager::Superimposition * SoRenderManager::addSuperimposition | ( | SoNode * | scene,
|  | uint32_t | flags = `Superimposition::AUTOREDRAW | Superimposition::ZBUFFERON | Superimposition::CLEARZBUFFER`
| ) |  |

Add a superimposition for this scene graph. A superimposition can either be a scene rendered in the background, or a scene rendered in the front of the actual scene graph.

This is useful, for instance, if you want to add a gradient or an image in the background, and for having some HUD info in the foreground.

Please note that if you use superimpositions, multipass antialiasing have to be handled in the render manager, and not in SoGLRenderAction, so the pass update features in SoGLRenderAction will be disabled.

See also
  SoGLRenderAction::setNumPasses()
  SoGLRenderAction::setPassUpdate()
  SoGLRenderAction::setPassCallback()

void SoRenderManager::removeSuperimposition | ( | Superimposition * | s | ) |

Removes a superimposition.

See also
  addSuperimposition()

void SoRenderManager::setSceneGraph | ( | SoNode *const | sceneroot | ) |
| virtual

Set the node which is top of the scene graph we're managing. The sceneroot node reference count will be increased by 1, and any previously set scene graph top node will have it's reference count decreased by 1.

See also
  getSceneGraph()

SoNode * SoRenderManager::getSceneGraph | ( | void |  | ) | const
| virtual

Returns pointer to root of scene graph.

void SoRenderManager::setCamera | ( | SoCamera * | camera | ) |

Sets the camera to be used.

SoCamera * SoRenderManager::getCamera | ( | void |  | ) | const

Returns the current camera.

void SoRenderManager::setAutoClipping | ( | AutoClippingStrategy | autoclipping | ) |

Sets strategy for adjusting camera clipping plane

See also
  SoRenderManager::AutoClippingStrategy

void SoRenderManager::attachRootSensor | ( | SoNode *const | sceneroot | ) |

Attaches this SoRenderManagers rootsensor to a scene

Parameters

  [in] | sceneroot | scene to attach to

Deprecated:
  Will not be available in Coin 4

void SoRenderManager::attachClipSensor | ( | SoNode *const | sceneroot | ) |

Attaches this SoRenderManagers clipsensor to a scene

Parameters

  [in] | sceneroot | scene to attach to

Deprecated:
  Will not be available in Coin 4

void SoRenderManager::detachRootSensor | ( | void |  | ) |

Detaches the rootsensor from all tracked scenes

Deprecated:
  Will not be available in Coin 4

void SoRenderManager::detachClipSensor | ( | void |  | ) |

Detaches the clipsensor from all tracked scenes

Deprecated:
  Will not be available in Coin 4

SoRenderManager::AutoClippingStrategy SoRenderManager::getAutoClipping | ( | void |  | ) | const

This method returns the current autoclipping strategy.

See also
  setAutoClipping

void SoRenderManager::setNearPlaneValue | ( | float | value | ) |

When the NbSceneManager::FIXED_NEAR_PLANE autoclipping strategy is used, you set the value of the near plane distance with this method.

See also
  setAutoClipping, getNearPlaneValue, NbSceneManager::AutoClippingStrategy

float SoRenderManager::getNearPlaneValue | ( | void |  | ) | const

This method returns the near plane distance value that will be used when the NbSceneManager::FIXED_NEAR_PLANE autoclipping strategy is used.

Default value is 0.6.

See also
  setAutoClipping, setNearPlaneValue, NbSceneManager::AutoClippingStrategy

void SoRenderManager::setTexturesEnabled | ( | const SbBool | onoff | ) |

Enable/disable textures when rendering. Defaults to TRUE.

See also
  isTexturesEnabled

SbBool SoRenderManager::isTexturesEnabled | ( | void |  | ) | const

Returns whether textures are enabled or not.

See also
  setTexturesEnabled

void SoRenderManager::setDoubleBuffer | ( | const SbBool | enable | ) |

Tell the scenemanager that double buffering is used

SbBool SoRenderManager::isDoubleBuffer | ( | void |  | ) | const

returns if the scenemanager is double buffered

void SoRenderManager::setRenderMode | ( | const RenderMode | mode | ) |

Sets the render mode.

SoRenderManager::RenderMode SoRenderManager::getRenderMode | ( | void |  | ) | const

Returns the current render mode.

void SoRenderManager::setStereoMode | ( | const StereoMode | mode | ) |

Sets the stereo mode.

SoRenderManager::StereoMode SoRenderManager::getStereoMode | ( | void |  | ) | const

Returns the current stereo mode.

void SoRenderManager::setStereoOffset | ( | const float | offset | ) |

Sets the stereo offset used when doing stereo rendering.

float SoRenderManager::getStereoOffset | ( | void |  | ) | const

Returns the current stereo offset.

void SoRenderManager::setRenderCallback | ( | SoRenderManagerRenderCB * | f,
|  | void *const | userdata = `NULL`
| ) |  |

Set the callback function f to invoke when rendering the scene. userdata will be passed as the first argument of the function.

SbBool SoRenderManager::isAutoRedraw | ( | void |  | ) | const

Returns `TRUE` if the SoSceneManager automatically redraws the scene upon detecting changes in the scene graph.

The automatic redraw is turned on and off by setting either a valid callback function with setRenderCallback(), or by passing `NULL`.

void SoRenderManager::setRedrawPriority | ( | const uint32_t | priority | ) |

Set up the redraw priority for the SoOneShotSensor used to trigger redraws. By setting this lower than for your own sensors, you can make sure some code is always run before redraw happens.

See also
  SoDelayQueueSensor

uint32_t SoRenderManager::getRedrawPriority | ( | void |  | ) | const

Returns value of priority on the redraw sensor.

void SoRenderManager::nodesensorCB | ( | void * | data,
|  | SoSensor * |
| ) |  |
| static

Internal callback

Parameters

  [in] | data | Pointer to SoRenderManager

Deprecated:
  Will be made private in a later version of Coin

void SoRenderManager::prerendercb | ( | void * | userdata,
|  | SoGLRenderAction * | action
| ) |  |
| static

Internal callback

Parameters

  [in] | userdata | GLbitfield mask
  [in] | action | Calling action

Deprecated:
  Will be made private in a later version of Coin

void SoRenderManager::reinitialize | ( | void |  | ) |

Reinitialize after parameters affecting the OpenGL context has changed.

void SoRenderManager::scheduleRedraw | ( | void |  | ) |

Redraw at first opportunity as system becomes idle.

Multiple calls to this method before an actual redraw has taken place will only result in a single redraw of the scene.

void SoRenderManager::setWindowSize | ( | const SbVec2s & | newsize | ) |

Update window size of our SoGLRenderAction's viewport settings.

Note that this will only change the information about window dimensions, the actual viewport size and origin (ie the rectangle which redraws are confined to) will stay the same.

See also
  setViewportRegion()

const SbVec2s & SoRenderManager::getWindowSize | ( | void |  | ) | const

Returns the current render action window size.

See also
  setWindowSize()

void SoRenderManager::setSize | ( | const SbVec2s & | newsize | ) |

Set size of rendering area for the viewport within the current window.

const SbVec2s & SoRenderManager::getSize | ( | void |  | ) | const

Returns size of render area.

void SoRenderManager::setOrigin | ( | const SbVec2s & | newOrigin | ) |

Set only the origin of the viewport region within the rendering window.

See also
  setViewportRegion(), setWindowSize()

const SbVec2s & SoRenderManager::getOrigin | ( | void |  | ) | const

Returns origin of rendering area viewport.

See also
  setOrigin()

void SoRenderManager::setViewportRegion | ( | const SbViewportRegion & | newregion | ) |

Update our SoGLRenderAction's viewport settings.

This will change both the information about window dimensions and the actual viewport size and origin.

See also
  setWindowSize()

const SbViewportRegion & SoRenderManager::getViewportRegion | ( | void |  | ) | const

Returns current viewport region used by the renderaction and the event handling.

See also
  setViewportRegion()

void SoRenderManager::setBackgroundColor | ( | const SbColor4f & | color | ) |

Sets color of rendering canvas.

const SbColor4f & SoRenderManager::getBackgroundColor | ( | void |  | ) | const

Returns color used for clearing the rendering area before rendering the scene.

void SoRenderManager::setBackgroundIndex | ( | const int | index | ) |

Set index of background color in the color lookup table if rendering in colorindex mode.

Note: colorindex mode is not supported yet in Coin.

int SoRenderManager::getBackgroundIndex | ( | void |  | ) | const

Returns index of colormap for background filling.

See also
  setBackgroundIndex()

void SoRenderManager::setRGBMode | ( | const SbBool | yes | ) |

Turn RGB truecolor mode on or off. If you turn truecolor mode off, colorindex mode will be used instead.

SbBool SoRenderManager::isRGBMode | ( | void |  | ) | const

Returns the "truecolor or colorindex" mode flag.

void SoRenderManager::activate | ( | void |  | ) |
| virtual

Activate rendering and event handling. Default is `off`.

void SoRenderManager::deactivate | ( | void |  | ) |
| virtual

Deactive rendering and event handling.

void SoRenderManager::setAntialiasing | ( | const SbBool | smoothing,
|  | const int | numpasses
| ) |  |

Turn antialiased rendering on or off.

See documentation for SoGLRenderAction::setSmoothing() and SoGLRenderAction::setNumPasses().

void SoRenderManager::getAntialiasing | ( | SbBool & | smoothing,
|  | int & | numpasses
| ) |  | const

Returns rendering pass information.

See also
  setAntialiasing()

void SoRenderManager::setGLRenderAction | ( | SoGLRenderAction *const | action | ) |

Set the action to use for rendering. Overrides the default action made in the constructor.

SoGLRenderAction * SoRenderManager::getGLRenderAction | ( | void |  | ) | const

Returns pointer to render action.

void SoRenderManager::setAudioRenderAction | ( | SoAudioRenderAction *const | action | ) |

Set the action to use for rendering audio. Overrides the default action made in the constructor.

SoAudioRenderAction * SoRenderManager::getAudioRenderAction | ( | void |  | ) | const

Returns pointer to audio render action.

void SoRenderManager::enableRealTimeUpdate | ( | const SbBool | flag | ) |
| static

Set whether or not for SoSceneManager instances to "touch" the global `realTime` field after a redraw. If this is not done, redrawing when animating the scene will only happen as fast as the `realTime` interval goes (which defaults to 12 times a second).

See also
  SoDB::setRealTimeInterval()

SbBool SoRenderManager::isRealTimeUpdateEnabled | ( | void |  | ) |
| static

Returns whether or not we automatically notifies everything connected to the `realTime` field after a redraw.

uint32_t SoRenderManager::getDefaultRedrawPriority | ( | void |  | ) |
| static

Returns the default priority of the redraw sensor.

See also
  SoDelayQueueSensor, setRedrawPriority()

void SoRenderManager::addPreRenderCallback | ( | SoRenderManagerRenderCB * | cb,
|  | void * | data
| ) |  |

Adds a function to be called before rendering starts

Parameters

  [in] | cb | function to be called
  [in] | data | User specified data to supply to callback function

void SoRenderManager::removePreRenderCallback | ( | SoRenderManagerRenderCB * | cb,
|  | void * | data
| ) |  |

Removes a prerendercallback.

Precondition
  The tuple (cb, data) must exactly match an earlier call to SoRenderManager::addPreRenderCallback

Parameters

  [in] | cb | function to be called
  [in] | data | User specified data to supply to callback function

void SoRenderManager::addPostRenderCallback | ( | SoRenderManagerRenderCB * | cb,
|  | void * | data
| ) |  |

Adds a function to be called after rendering is complete

Parameters

  [in] | cb | function to be called
  [in] | data | User specified data to supply to callback function

void SoRenderManager::removePostRenderCallback | ( | SoRenderManagerRenderCB * | cb,
|  | void * | data
| ) |  |

Removes a postrendercallback.

Precondition
  The tuple (cb, data) must exactly match an earlier call to SoRenderManager::addPostRenderCallback

Parameters

  [in] | cb | function to be called
  [in] | data | User specified data to supply to callback function

int SoRenderManager::isActive | ( | void |  | ) | const
| protected

Returns the active flag.

void SoRenderManager::redraw | ( | void |  | ) |
| protected

Do an immediate redraw by calling the redraw callback function.

void SoRenderManager::renderScene | ( | SoGLRenderAction * | action,
|  | SoNode * | scene,
|  | uint32_t | clearmask
| ) |  |
| protected

Renders a scene and applies clear state as given by this renderManager

Parameters

  [in] | action | Action to apply
  [in] | scene | Scene to render
  [in] | clearmask | mask to pass to glClear

void SoRenderManager::actuallyRender | ( | SoGLRenderAction * | action,
|  | const SbBool | initmatrices = `TRUE`,
|  | const SbBool | clearwindow = `TRUE`,
|  | const SbBool | clearzbuffer = `TRUE`
| ) |  |
| protected

Convenience function for SoRenderManager::renderScene

Parameters

  [in] | action | Renders with a user supplied action
  [in] | initmatrices | if true, the projection and modelview matrices are reset to identity
  [in] | clearwindow | If set to `TRUE`, clear the rendering buffer before drawing.
  [in] | clearzbuffer | If set to `TRUE`, clear the depth buffer values before rendering.

void SoRenderManager::renderSingle | ( | SoGLRenderAction * | action,
|  | SbBool | initmatrices,
|  | SbBool | clearwindow,
|  | SbBool | clearzbuffer
| ) |  |
| protected

Render once in correct draw style.

Convenience function for SoRenderManager::renderScene

Parameters

  [in] | action | Renders with a user supplied action
  [in] | initmatrices | if true, the projection and modelview matrices are reset to identity
  [in] | clearwindow | If set to `TRUE`, clear the rendering buffer before drawing.
  [in] | clearzbuffer | If set to `TRUE`, clear the depth buffer values before rendering.

void SoRenderManager::renderStereo | ( | SoGLRenderAction * | action,
|  | SbBool | initmatrices,
|  | SbBool | clearwindow,
|  | SbBool | clearzbuffer
| ) |  |
| protected

Render scene according to current stereo mode.

Convenience function for SoRenderManager::renderScene

Parameters

  [in] | action | Renders with a user supplied action
  [in] | initmatrices | if true, the projection and modelview matrices are reset to identity
  [in] | clearwindow | If set to `TRUE`, clear the rendering buffer before drawing.
  [in] | clearzbuffer | If set to `TRUE`, clear the depth buffer values before rendering.

void SoRenderManager::initStencilBufferForInterleavedStereo | ( | void |  | ) |
| protected

Initializes stencilbuffers for interleaved stereo

void SoRenderManager::clearBuffers | ( | SbBool | color,
|  | SbBool | depth
| ) |  |
| protected

Clears buffers with the backgroundcolor set correctly

Parameters

  [in] | color | Set to `TRUE` if color buffer should be cleared
  [in] | depth | Set to `TRUE` if depth buffer should be cleared

The documentation for this class was generated from the following files:

- SoRenderManager.h
- SoRenderManager.cpp

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.