SoRenderToTarget Class Reference
[Groups]

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 {
  COLOR0,
  COLOR1,
  COLOR2,
  COLOR3,
  COLOR4,
  COLOR5,
  COLOR6,
  COLOR7,
  COLOR8,
  COLOR9,
  COLOR10,
  COLOR11,
  COLOR12,
  COLOR13,
  COLOR14,
  COLOR15,
  DEPTH,
  STENCIL,
  DEPTH_STENCIL,
  LAST_ENTRY
}
enum  Mode {
  AUTO,
  INTERNAL,
  TARGET_COPY,
  NONE
}

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
SoSFVec4f clearColorValue
SoSFFloat clearDepthValue
SoSFInt32 clearStencilValue
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. The values used to clear the buffers can be specified by the fields clearColorValue, clearDepthValue and clearStencilValue. It is also 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.

NOTES:

NOTE: node available since Open Inventor 8.6

FILE FORMAT/DEFAULT

ACTION BEHAVIOR

SEE ALSO

SoTexture, SoTexture2.


Member Enumeration Documentation

Attachment.

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.

Enumerator:
COLOR0 

Default attachment used for rendering.

COLOR1 
COLOR2 
COLOR3 
COLOR4 
COLOR5 
COLOR6 
COLOR7 
COLOR8 
COLOR9 
COLOR10 
COLOR11 
COLOR12 
COLOR13 
COLOR14 
COLOR15 
DEPTH 
STENCIL 
DEPTH_STENCIL 
LAST_ENTRY 

Not used, for security only.

This enum defines modifiers for the auto detection mechanism.

Enumerator:
AUTO 

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.

INTERNAL 

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.

TARGET_COPY 

After the rendering the rendered content is copied back to the node in CPU memory.

NONE 

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.

Value used to clear the color buffer before the rendering.

Default is (0.0, 0.0, 0.0, 0.0).

Value used to clear the depth buffer before the rendering.

Default is 1.0.

Value used to clear the stencil buffer before the rendering.

Default is 0.

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 or SoTextureCubeMap.

It describes the layer where the color attachment must be written, along the Z dimension for SoTexture3, or the cube map face for SoTextureCubeMap (the cube map faces order is presented in the table below). 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.

Layer number

Cube Map Face

0

Positive X

1

Negative X

2

Positive Y

3

Negative Y

4

Positive Z

5

Negative Z

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, SoTexture3 and SoTextureCubeMap. 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 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/