Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoRenderManager Class Reference

The SoRenderManager class is used for controlling the rendering of a scene graph. More...

#include <Inventor/SoRenderManager.h>

Classes

class  Superimposition
 

Public Types

enum  AutoClippingStrategy { NO_AUTO_CLIPPING , FIXED_NEAR_PLANE , VARIABLE_NEAR_PLANE }
 
enum  BufferType { BUFFER_SINGLE , BUFFER_DOUBLE }
 
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
}
 

Public Member Functions

 SoRenderManager (void)
 
virtual ~SoRenderManager ()
 
virtual void activate (void)
 
void addPostRenderCallback (SoRenderManagerRenderCB *cb, void *data)
 
void addPreRenderCallback (SoRenderManagerRenderCB *cb, void *data)
 
SuperimpositionaddSuperimposition (SoNode *scene, uint32_t flags=Superimposition::AUTOREDRAW|Superimposition::ZBUFFERON|Superimposition::CLEARZBUFFER)
 
virtual void deactivate (void)
 
void getAntialiasing (SbBool &smoothing, int &numPasses) const
 
SoAudioRenderActiongetAudioRenderAction (void) const
 
AutoClippingStrategy getAutoClipping (void) const
 
const SbColor4fgetBackgroundColor (void) const
 
int getBackgroundIndex (void) const
 
SoCameragetCamera (void) const
 
SoGLRenderActiongetGLRenderAction (void) const
 
float getNearPlaneValue (void) const
 
const SbVec2sgetOrigin (void) const
 
SbColor4f getOverlayColor (void) const
 
uint32_t getRedrawPriority (void) const
 
RenderMode getRenderMode (void) const
 
virtual SoNodegetSceneGraph (void) const
 
const SbVec2sgetSize (void) const
 
StereoMode getStereoMode (void) const
 
float getStereoOffset (void) const
 
const SbViewportRegiongetViewportRegion (void) const
 
const SbVec2sgetWindowSize (void) const
 
SbBool isAutoRedraw (void) const
 
SbBool isDoubleBuffer (void) const
 
SbBool isRGBMode (void) const
 
SbBool isTexturesEnabled (void) const
 
void reinitialize (void)
 
void removePostRenderCallback (SoRenderManagerRenderCB *cb, void *data)
 
void removePreRenderCallback (SoRenderManagerRenderCB *cb, void *data)
 
void removeSuperimposition (Superimposition *s)
 
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)
 
void scheduleRedraw (void)
 
void setAntialiasing (const SbBool smoothing, const int numPasses)
 
void setAudioRenderAction (SoAudioRenderAction *const action)
 
void setAutoClipping (AutoClippingStrategy autoclipping)
 
void setBackgroundColor (const SbColor4f &color)
 
void setBackgroundIndex (const int index)
 
void setCamera (SoCamera *camera)
 
void setDoubleBuffer (const SbBool enable)
 
void setGLRenderAction (SoGLRenderAction *const action)
 
void setNearPlaneValue (float value)
 
void setOrigin (const SbVec2s &newOrigin)
 
void setOverlayColor (const SbColor4f &color)
 
void setRedrawPriority (const uint32_t priority)
 
void setRenderCallback (SoRenderManagerRenderCB *f, void *const userData=NULL)
 
void setRenderMode (const RenderMode mode)
 
void setRGBMode (const SbBool onOrOff)
 
virtual void setSceneGraph (SoNode *const sceneroot)
 
void setSize (const SbVec2s &newsize)
 
void setStereoMode (const StereoMode mode)
 
void setStereoOffset (const float offset)
 
void setTexturesEnabled (const SbBool onoff)
 
void setViewportRegion (const SbViewportRegion &newRegion)
 
void setWindowSize (const SbVec2s &newsize)
 

Static Public Member Functions

static void enableRealTimeUpdate (const SbBool flag)
 
static uint32_t getDefaultRedrawPriority (void)
 
static SbBool isRealTimeUpdateEnabled (void)
 

Protected Member Functions

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

Detailed Description

The SoRenderManager class is used for controlling the rendering of a scene graph.

You can use this class to configure things like clipping planes, rendering mode, stereo rendering and the background color. In earlier versions of Coin/Inventor, this was set up in the GUI toolkits, making it quite hard to make a new Coin viewer for another GUI toolkit. With this new class all that is needed is to create one SoRenderManager instance per viewer/view.

This class does not handle events for the scene graph/viewer. To do that you can use the SoEventManager class.

Since
Coin 3.0

Member Enumeration Documentation

◆ AutoClippingStrategy

Strategy for adjusting camera near/far clipping plane

Enumerator
NO_AUTO_CLIPPING 

Turn off automatic clipping. The user needs to set the correct values in the camera.

FIXED_NEAR_PLANE 

Keep near plane at a fixed distance from the camera. The far plane is always set at the end of the bounding box.

VARIABLE_NEAR_PLANE 

Variable adjustment of the near plane relative to the camera.

◆ BufferType

Buffering strategy

Enumerator
BUFFER_SINGLE 

Output to one buffer

BUFFER_DOUBLE 

Alternate between output buffers

◆ RenderMode

Sets how rendering of primitives is done.

Enumerator
AS_IS 

Render primitives as they are described in the scene graph.

WIREFRAME 

Render polygons as wireframe

POINTS 

Render only the vertices of the polygons and lines.

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.

◆ StereoMode

Manages how to render stereoscopic images.

Enumerator
MONO 

No stereoscopic rendering

ANAGLYPH 

Anaglyph rendering is used to provide a stereoscopic 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 (glasses)

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 can 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 can be used to give a 3D effect.

Constructor & Destructor Documentation

◆ SoRenderManager()

SoRenderManager::SoRenderManager ( void )

Constructor.

◆ ~SoRenderManager()

SoRenderManager::~SoRenderManager ( )
virtual

Destructor.

Member Function Documentation

◆ activate()

void SoRenderManager::activate ( void )
virtual

Activate rendering and event handling. Default is off.

◆ actuallyRender()

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]actionRenders with a user supplied action.
[in]initmatricesIf set to TRUE, the projection and modelview matrices are reset to identity.
[in]clearwindowIf set to TRUE, clear the rendering buffer before drawing.
[in]clearzbufferIf set to TRUE, clear the depth buffer values before rendering.

◆ addPostRenderCallback()

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

Adds a function to be called after rendering is complete

Parameters
[in]cbfunction to be called
[in]dataUser specified data to supply to callback function

◆ addPreRenderCallback()

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

Adds a function to be called before rendering starts

Parameters
[in]cbfunction to be called
[in]dataUser specified data to supply to callback function

◆ addSuperimposition()

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()

◆ clearBuffers()

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

Clears buffers with the background color set correctly

Parameters
[in]colorSet to TRUE if color buffer should be cleared
[in]depthSet to TRUE if depth buffer should be cleared

◆ deactivate()

void SoRenderManager::deactivate ( void )
virtual

Deactivate rendering and event handling.

◆ enableRealTimeUpdate()

void SoRenderManager::enableRealTimeUpdate ( const SbBool flag)
static

Set whether or not for SoRenderManager 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()

◆ getAntialiasing()

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

Returns rendering pass information.

See also
setAntialiasing()

◆ getAudioRenderAction()

SoAudioRenderAction * SoRenderManager::getAudioRenderAction ( void ) const

Returns pointer to audio render action.

◆ getAutoClipping()

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

This method returns the current auto clipping strategy.

See also
setAutoClipping

◆ getBackgroundColor()

const SbColor4f & SoRenderManager::getBackgroundColor ( void ) const

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

◆ getBackgroundIndex()

int SoRenderManager::getBackgroundIndex ( void ) const

Returns index of color map for background filling.

See also
setBackgroundIndex()

◆ getCamera()

SoCamera * SoRenderManager::getCamera ( void ) const

Returns the current camera.

◆ getDefaultRedrawPriority()

uint32_t SoRenderManager::getDefaultRedrawPriority ( void )
static

Returns the default priority of the redraw sensor.

See also
SoDelayQueueSensor, setRedrawPriority()

◆ getGLRenderAction()

SoGLRenderAction * SoRenderManager::getGLRenderAction ( void ) const

Returns pointer to render action.

◆ getNearPlaneValue()

float SoRenderManager::getNearPlaneValue ( void ) const

This method returns the near plane distance value that will be used when the SoRenderManager::FIXED_NEAR_PLANE auto clipping strategy is used.

Default value is 0.6.

See also
setAutoClipping, setNearPlaneValue, SoRenderManager::AutoClippingStrategy

◆ getOrigin()

const SbVec2s & SoRenderManager::getOrigin ( void ) const

Returns origin of rendering area viewport.

See also
setOrigin()

◆ getOverlayColor()

SbColor4f SoRenderManager::getOverlayColor ( void ) const

Returns color used rendering overlay.

◆ getRedrawPriority()

uint32_t SoRenderManager::getRedrawPriority ( void ) const

Returns value of priority on the redraw sensor.

◆ getRenderMode()

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

Returns the current render mode.

◆ getSceneGraph()

SoNode * SoRenderManager::getSceneGraph ( void ) const
virtual

Returns the pointer to root of scene graph.

◆ getSize()

const SbVec2s & SoRenderManager::getSize ( void ) const

Returns size of render area.

◆ getStereoMode()

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

Returns the current stereo mode.

◆ getStereoOffset()

float SoRenderManager::getStereoOffset ( void ) const

Returns the current stereo offset.

◆ getViewportRegion()

const SbViewportRegion & SoRenderManager::getViewportRegion ( void ) const

Returns current viewport region used by the render action and the event handling.

See also
setViewportRegion()

◆ getWindowSize()

const SbVec2s & SoRenderManager::getWindowSize ( void ) const

Returns the current render action window size.

See also
setWindowSize()

◆ initStencilBufferForInterleavedStereo()

void SoRenderManager::initStencilBufferForInterleavedStereo ( void )
protected

Initializes stencil buffers for interleaved stereo

◆ isActive()

int SoRenderManager::isActive ( void ) const
protected

Returns the active flag.

◆ isAutoRedraw()

SbBool SoRenderManager::isAutoRedraw ( void ) const

Returns TRUE if the SoRenderManager 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.

◆ isDoubleBuffer()

SbBool SoRenderManager::isDoubleBuffer ( void ) const

returns if the scene manager is double buffered

◆ isRealTimeUpdateEnabled()

SbBool SoRenderManager::isRealTimeUpdateEnabled ( void )
static

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

◆ isRGBMode()

SbBool SoRenderManager::isRGBMode ( void ) const

Returns the "truecolor or colorindex" mode flag.

◆ isTexturesEnabled()

SbBool SoRenderManager::isTexturesEnabled ( void ) const

Returns whether textures are enabled or not.

See also
setTexturesEnabled

◆ redraw()

void SoRenderManager::redraw ( void )
protected

Do an immediate redraw by calling the redraw callback function.

◆ reinitialize()

void SoRenderManager::reinitialize ( void )

Reinitialize after parameters affecting the OpenGL context have changed.

◆ removePostRenderCallback()

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

Removes a post render callback.

Precondition
The tuple (cb, data) must exactly match an earlier call to SoRenderManager::addPostRenderCallback
Parameters
[in]cbfunction to be called
[in]dataUser specified data to supply to callback function

◆ removePreRenderCallback()

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

Removes a pre render callback.

Precondition
The tuple (cb, data) must exactly match an earlier call to SoRenderManager::addPreRenderCallback
Parameters
[in]cbfunction to be called
[in]dataUser specified data to supply to callback function

◆ removeSuperimposition()

void SoRenderManager::removeSuperimposition ( Superimposition * s)

Removes a superimposition.

See also
addSuperimposition()

◆ render() [1/2]

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]clearwindowIf set to TRUE, clear the rendering buffer before drawing.
[in]clearzbufferIf set to TRUE, clear the depth buffer values before rendering.

◆ render() [2/2]

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]clearwindowIf set to TRUE, clear the rendering buffer before drawing.
[in]clearzbufferIf set to TRUE, clear the depth buffer values before rendering.
[in]initmatricesIf set to TRUE, the projection and modelview matrices are reset to identity.
[in]actionRenders with a user supplied action.

◆ renderScene()

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]actionAction to apply
[in]sceneScene to render
[in]clearmaskmask to pass to glClear

◆ renderSingle()

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]actionRenders with a user supplied action.
[in]initmatricesIf set to TRUE, the projection and modelview matrices are reset to identity.
[in]clearwindowIf set to TRUE, clear the rendering buffer before drawing.
[in]clearzbufferIf set to TRUE, clear the depth buffer values before rendering.

◆ renderStereo()

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]actionRenders with a user supplied action.
[in]initmatricesIf set to TRUE, the projection and modelview matrices are reset to identity.
[in]clearwindowIf set to TRUE, clear the rendering buffer before drawing.
[in]clearzbufferIf set to TRUE, clear the depth buffer values before rendering.

◆ scheduleRedraw()

void SoRenderManager::scheduleRedraw ( void )

Redraw at first opportunity as system becomes idle.

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

◆ setAntialiasing()

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

Turn antialiased rendering on or off.

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

◆ setAudioRenderAction()

void SoRenderManager::setAudioRenderAction ( SoAudioRenderAction *const action)

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

◆ setAutoClipping()

void SoRenderManager::setAutoClipping ( AutoClippingStrategy autoclipping)

Sets strategy for adjusting camera clipping plane

See also
SoRenderManager::AutoClippingStrategy

◆ setBackgroundColor()

void SoRenderManager::setBackgroundColor ( const SbColor4f & color)

Sets color of rendering canvas.

◆ setBackgroundIndex()

void SoRenderManager::setBackgroundIndex ( const int index)

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

Note: color index mode is not supported yet in Coin.

◆ setCamera()

void SoRenderManager::setCamera ( SoCamera * camera)

Sets the camera to be used.

◆ setDoubleBuffer()

void SoRenderManager::setDoubleBuffer ( const SbBool enable)

Tell the scene manager that double buffering is used

◆ setGLRenderAction()

void SoRenderManager::setGLRenderAction ( SoGLRenderAction *const action)

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

◆ setNearPlaneValue()

void SoRenderManager::setNearPlaneValue ( float value)

When the SoRenderManager::FIXED_NEAR_PLANE auto clipping strategy is used, you set the value of the near plane distance with this method.

See also
setAutoClipping, getNearPlaneValue, SoRenderManager::AutoClippingStrategy

◆ setOrigin()

void SoRenderManager::setOrigin ( const SbVec2s & newOrigin)

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

See also
setViewportRegion(), setWindowSize()

◆ setOverlayColor()

void SoRenderManager::setOverlayColor ( const SbColor4f & color)

Sets color of overlay.

◆ setRedrawPriority()

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

◆ setRenderCallback()

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.

◆ setRenderMode()

void SoRenderManager::setRenderMode ( const RenderMode mode)

Sets the render mode.

◆ setRGBMode()

void SoRenderManager::setRGBMode ( const SbBool yes)

Turn RGB true color mode on or off. If you turn true color mode off, color index mode will be used instead.

◆ setSceneGraph()

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 its reference count decreased by 1.

See also
getSceneGraph()

◆ setSize()

void SoRenderManager::setSize ( const SbVec2s & newsize)

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

◆ setStereoMode()

void SoRenderManager::setStereoMode ( const StereoMode mode)

Sets the stereo mode.

◆ setStereoOffset()

void SoRenderManager::setStereoOffset ( const float offset)

Sets the stereo offset used when doing stereo rendering.

◆ setTexturesEnabled()

void SoRenderManager::setTexturesEnabled ( const SbBool onoff)

Enable/disable textures when rendering. Defaults to TRUE.

See also
isTexturesEnabled

◆ setViewportRegion()

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()

◆ setWindowSize()

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 (i.e. the rectangle which redraws are confined to) will stay the same.

See also
setViewportRegion()

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