Group node that renders its children to one or more "targets". More...
#include <Inventor/nodes/SoRenderToTarget.h>
Public Types | |
enum | Attachment { COLOR0, COLOR1, COLOR2, COLOR3, COLOR4, COLOR5, COLOR6, COLOR7, COLOR8, COLOR9, COLOR10, COLOR11, COLOR12, COLOR13, COLOR14, COLOR15, 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 |
SoSFFloat | antialiasingQuality |
SoSFVec2i32 | size |
SoSFBool | enableFragmentsQuery |
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.
NOTES:
modes | AUTO |
targets | NULL |
layers | 0 |
clearTargets | TRUE |
antialiasingQuality | 0.F |
size | (-1, -1) |
enableFragmentsQuery | FALSE |
This enum defines modifiers for the auto detection mechanism.
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 (SoTexture2 only). |
NONE |
Do not use any target. |
SoRenderToTarget::SoRenderToTarget | ( | ) |
Default constructor.
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.
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.
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):
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):