public class SoRenderToTarget extends SoSeparator
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:
SoSFImage
field of the texture.
SoTexture2
and SoTexture3
nodes are supported. Using other types in the targets field will result in SoDebugErrors.
SoTexture
.
SoRenderToTarget
is an SoSeparator
and can be added directly to the scene graph. In this case its children are rendered as part of the main scene graph and inherit properties (camera, light, material, etc) from the main scene graph. SoRenderToTarget
can also be used separate from the main scene graph and re-rendered as-needed by applying an SoGLRenderAction
. In this case the children of the SoRenderToTarget
will normally include a camera, light, etc node. But also note that, in this case, the OpenGL calls normally made by the viewer and/or SoSceneManager
will not be done automatically. For example, the OpenGL depth test is not enabled. Use an SoDepthBuffer
node to do this.
SoRenderToTarget
scenegraph is not really part of the main scene and should not have any effect on the bounding box computed for the main scene. But in some cases, it can be useful to include the SoRenderToTarget
scenegraph's bounding box, like when doing post-processing effects. In that case, manually set 'boundingBoxIgnoring' to false.
RenderToTarget {
modes | AUTO |
targets | NULL |
layers | 0 |
clearTargets | true |
clearColorValue | (0.F, 0.F, 0.F, 0.F) |
clearDepthValue | 1.F |
clearStencilValue | 0 |
antialiasingQuality | 0.F |
size | (-1, -1) |
enableFragmentsQuery | false |
Action behavior:
SoGLRenderAction
Performs an offscreen rendering using either FBO, PBuffer or pixmap. Sets: SoCacheElement
See also:
Modifier and Type | Class and Description |
---|---|
static class |
SoRenderToTarget.Attachments
Attachment.
|
static class |
SoRenderToTarget.ModeType
This enum defines modifiers for the auto detection mechanism.
|
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
SoNode.RenderModes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFFloat |
antialiasingQuality
This field defines the antialiasing quality between 0.0 and 1.0 for the rendering.
|
SoSFVec4f |
clearColorValue
Value used to clear the color buffer before the rendering.
|
SoSFFloat |
clearDepthValue
Value used to clear the depth buffer before the rendering.
|
SoSFInt32 |
clearStencilValue
Value used to clear the stencil buffer before the rendering.
|
SoSFBool |
clearTargets
If this field is set the targets are cleared before the rendering.
|
SoSFBool |
enableFragmentsQuery
This field enables or disables the query counter used to count the number of fragments rasterized during the render to texture operation.
|
SoMFInt32 |
layers
This field is used when targets are
SoTexture3 . |
SoMFEnum<SoRenderToTarget.ModeType> |
modes
This defines the mode modifier for the targets.
|
SoSFVec2i32 |
size
This field allows a custom rendering size for the render to texture.
|
SoMFNode |
targets
This field allows to attach a texture to a specific attachment.
|
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
boundingBoxIgnoring
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoRenderToTarget()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getRasterizedSamplesCount()
Returns the number of samples generated by the rasterizer during the last GLRender action.
|
static boolean |
isSupported()
Calls isSupported((com.openinventor.inventor.misc.SoState)null).
|
static boolean |
isSupported(SoState state)
Indicates if this node can be used on the actual hardware.
|
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
getNativeResourceHandle
public final SoMFEnum<SoRenderToTarget.ModeType> modes
Mode
. Default is AUTO.
NOTE: This field is indexed using the Attachment enum. For example (in pseudo-code):
public final SoMFNode targets
SoTexture2
and SoTexture3
, default is empty (no targets).
NOTE: This field is indexed using the Attachment enum. For example (in pseudo-code):
public final SoMFInt32 layers
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.public final SoSFBool clearTargets
public final SoSFVec4f clearColorValue
public final SoSFFloat clearDepthValue
public final SoSFInt32 clearStencilValue
public final SoSFFloat antialiasingQuality
NOTE: Hardware limitations: The result depends on the support for multisampling in FBO or the FSAA support for PBuffers.
public final SoSFVec2i32 size
public final SoSFBool enableFragmentsQuery
The method getRasterizedSamplesCount()
can be used to get the result of the query.
public static boolean isSupported()
public int getRasterizedSamplesCount()
public static boolean isSupported(SoState state)
SoGLExtension
for an example of using SoGLContext
to avoid them.Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com