SoRenderToTarget Class Reference

VSG extension Group node that renders its children to one or more "targets". More...

#include <Inventor/nodes/SoRenderToTarget.h>

Inheritance diagram for SoRenderToTarget:
SoSeparator SoGroup SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Types

enum  Attachment {
enum  Mode {

Public Member Functions

virtual SoType getTypeId () const
 SoRenderToTarget ()
int getRasterizedSamplesCount () const

Static Public Member Functions

static SoType getClassTypeId ()
static SbBool isSupported (SoState *state=NULL)

Public Attributes

SoMFEnum modes
SoMFNode targets
SoMFInt32 layers
SoSFBool clearTargets
SoSFFloat antialiasingQuality
SoSFVec2i32 size
SoSFBool enableFragmentsQuery

Detailed Description

VSG extension Group node that renders its children to one or more "targets".

This group node renders its children to one or more render targets.

Multiple targets can be "attached" to the different outputs of the node.

This node also provides antialiasing. When FrameBufferObjects (FBO) are used (this is the default mode if they are available) multisampling can be configured in order to perform antialiasing on the FBO. This MSAA feature is not related to the viewer's FSAA. The quality factor is set between 0.f(default value) and 1.f. The underlying system will setup the FBO with the correct number of samples according to the quality value and according to the attachments configuration.

By default the node clears the targets when the rendering is started. It is possible to disable this feature by setting the field clearTargets to FALSE.

During rendering, the viewport from the Open Inventor state is used, which means that the current size of the render area is used. It is possible to change this default behavior by setting the size field. Setting it to (-1, -1) will switch back to the default mode, other values will be used as the custom rendering size in pixels. The targets are automatically resized to the correct size.

The SoRenderToTextureProperty node can also be used to create a texture image and is useful for simpler cases.


NOTE: node available since Open Inventor 8.6




SoTexture, SoTexture2.

Member Enumeration Documentation


This enum is used to specify which output of the rasterizer is considered. Use these values as indices when setting the targets and modes fields.


Default attachment used for rendering.


Not used, for security only.

This enum defines modifiers for the auto detection mechanism.


Default value, use OIV auto detection algorithm.

The detection algorithm checks the content of the targets field. NOTE: The node will use INTERNAL for DEPTH and COLOR0, NONE for the others.


Use an internal buffer for the rendering.

Some buffers are useful only for shaders or for correct rendering (like depth buffer for the depth tests) but they don't need to be attached to a specific target.


After the rendering the rendered content is copied back to the node in CPU memory (SoTexture2 only).


Do not use any target.

Constructor & Destructor Documentation

SoRenderToTarget::SoRenderToTarget (  ) 

Default constructor.

Member Function Documentation

static SoType SoRenderToTarget::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoSeparator.

int SoRenderToTarget::getRasterizedSamplesCount (  )  const

Returns the number of samples generated by the rasterizer during the last GLRender action.

To enable this feature the enableFragmentsQuery field must be set to TRUE. Otherwise the result is undefined.

virtual SoType SoRenderToTarget::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoSeparator.

static SbBool SoRenderToTarget::isSupported ( SoState state = NULL  )  [static]

Indicates if this node can be used on the actual hardware.

When using a debug build of Open Inventor, some "no context available" warning messages may be generated. You can ignore them or see SoGLExtension for an example of using SoGLContext to avoid them.

Member Data Documentation

This field defines the antialiasing quality between 0.0 and 1.0 for the rendering.

The value 1.0 represents the maximun quality possible on this hardware. Default is 0.

NOTE: Hardware limitations: The result depends on the support for multisampling in FBO or the FSAA support for PBuffers.

If this field is set the targets are cleared before the rendering.

Default is TRUE.

This field enables or disables the query counter used to count the number of fragments rasterized during the render to texture operation.

Default is FALSE.

The method getRasterizedSamplesCount() can be used to get the result of the query.

This field is used when targets are SoTexture3.

It describes the layer, along the Z dimension of SoTexture3, where the color attachment must be written. This field is indexed by color attachments (i.e. from COLOR0 to COLOR15) and has no effect when targets are of type SoTexture2 or when target attachments are DEPTH or STENCIL, which require a SoTexture2 Target.

This defines the mode modifier for the targets.

For each target it is possible to specify a mode. Use enum Mode. Default is AUTO.

NOTE: This field is indexed using the Attachment enum. For example (in pseudo-code):

  • modes[COLOR0] = TARGET_AND_COPY;
  • modes[STENCIL] = INTERNAL;

This field allows a custom rendering size for the render to texture.

When this field is set to the default value (-1, -1) the global viewport size from the viewer is used. The size is in pixels.

This field allows to attach a texture to a specific attachment.

Supported target types are SoTexture2 and SoTexture3, default is empty (no targets).

NOTE: This field is indexed using the Attachment enum. For example (in pseudo-code):

  • targets[COLOR0] = rgbaTexture;
  • targets[STENCIL] = stencilTexture;

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

Open Inventor Toolkit reference manual, generated on 8 Apr 2021
Copyright © Thermo Fisher Scientific All rights reserved.