Class SoVertexAttribFeedback
- All Implemented Interfaces:
SafeDisposable
This node can only be used when an GLSL shader is enabled on the Open Inventor state. If the active shader contains a geometry shader the attributes are recorded from the varyings declared in it, otherwise it records the attributes from the vertex shader.
The function registerFeedback is used to specify the buffer object, which will receive the data, attached to a specified varying.
The scene graph which will be rendered during the traversal (can be any shape used as input of the geometry or vertex shader) is specified using the regular addChild function from the class SoSeparator
.
This node provides a mechanism for the following features:
- Rasterizer can be disabled to prevent rendering the generated primitives. This is useful when the main behavior is to record computed primitives from the geometry or vertex shader.
- The
SoGpuBufferObject
can be automatically resized to be able to record all the data. - The number of generated primitives can be retrieved after the traversal.
Limitations
- The automatic resize of the buffer objects requires two traversal of the children, one to compute the number of primitives which will be generated and the actual traversal.
- Most of the regular actions (except Render and Write) don't traverse the children.
File format/default:
VertexAttribFeedback {
disableFragmentProcessing true autoResizeBuffers false queryGeneratedPrimitivesCount false buffersMode SEPARATE primitiveType TRIANGLES Action behavior:
SoGLRenderAction
Do the actual vertex attributes feedback operation.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
This enum is used by the field buffersMode to describe the data packing format in the buffer objects.static enum
This enum is used to setup the expected recorded primitive type from the shaders.Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoSeparator
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SoSFBool
Set this field to true when the size of the recorded varyings is not known.The buffer mode used to record the primitives.final SoSFBool
Turn off the fragment rasterizer.The type of primitive recorded during traversal.final SoSFBool
Read back the number of recorded primitives.Fields inherited from class com.openinventor.inventor.nodes.SoSeparator
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
Fields inherited from class com.openinventor.inventor.nodes.SoGroup
boundingBoxIgnoring
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
This function returns the number of generated primitives during the traversal of the sub scene graph.static boolean
isSupported
(SoState state) This function indicates if the vertex attributes feedback feature is available on this system.void
registerFeedback
(String varyingName, SoBufferObject bufferObject) Calls registerFeedback(varyingName, bufferObject, (int)-1).void
registerFeedback
(String varyingName, SoBufferObject bufferObject, int primitiveSize) This function allows to attach a buffer object to a specific varying of the shader pushed on the state.void
unregisterFeedback
(String varyingName) This function is used to unregister a varying registered with the registerFeedback function.Methods inherited from class com.openinventor.inventor.nodes.SoGroup
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
Methods inherited from class com.openinventor.inventor.nodes.SoNode
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
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
disableFragmentProcessing
Turn off the fragment rasterizer. It means that the result of the shader is not rendered.Most of the time the main goal of this node is to record the result of varyings from the geometry shaders and the recorded primitives are not supposed to be rendered.
Default value is true.
-
autoResizeBuffers
Set this field to true when the size of the recorded varyings is not known. It provides a mechanism to automatically resize the buffer objects.This is implemented by performing a first traversal of the children with OpenGL queries enabled to record the number of generated primitives during this traversal. Then the value of the query is used to compute the size in bytes of the buffer object and a second traversal is performed for the actual primitives recording.
Default value is false.
-
queryGeneratedPrimitivesCount
Read back the number of recorded primitives. The read back is performed only when this field is set to true and the method getGeneratedPrimitivesCount returns the value.Default value is false.
-
buffersMode
The buffer mode used to record the primitives. . Default is SEPARATE. -
primitiveType
The type of primitive recorded during traversal. Use enumPrimitiveType
. Default is TRIANGLES.
-
-
Constructor Details
-
SoVertexAttribFeedback
public SoVertexAttribFeedback()Default constructor.
-
-
Method Details
-
registerFeedback
Calls registerFeedback(varyingName, bufferObject, (int)-1). -
registerFeedback
This function allows to attach a buffer object to a specific varying of the shader pushed on the state. When the buffersMode field is set to INTERLEAVED only the first specified bufferObject is used.The primitiveSize parameter is used to compute the actual size of buffer objects when autoResizeBuffers is set to true, it is ignored otherwise; It must be the size of each primitive, in bytes. When the buffer mode is set to INTERLEAVED the value must be the accumulated size in bytes for all the varyings. The actual buffer size is computed by multiplying the primitiveSize by the number of primitives and by the size of the data type (float). When the value is -1 (the default value) Open Inventor uses 3 * sizeof(float) * numVerticesPerPrimtive, which is the size of a basic triangle with 3 vertices of 3 float-components, for a triangle the computed value is 3 * sizeof(float) * 3.
NOTE: When the buffer mode is set to INTERLEAVED only the first specified buffer object is used the following ones are ignored.
- Parameters:
varyingName
- The name of the varying which must will be added to the list of recorded varyings.bufferObject
- The buffer object which will receive the recorded values from the varying.primitiveSize
- The size, in bytes, of one primitive, used when the autoResizeBuffers field is set to true.
-
unregisterFeedback
This function is used to unregister a varying registered with the registerFeedback function.- Parameters:
varyingName
- The name of the varying to unregister, previously registered using the registerFeeback function.
-
isSupported
This function indicates if the vertex attributes feedback feature is available on this system. When using a debug build of Open Inventor, some "no context available" warning messages may be generated. You can ignore them or seeSoGLExtension
for an example of usingSoGLContext
to avoid them.- Returns:
- true if vertex attributes feedback is supported.
-
getGeneratedPrimitivesCount
public int getGeneratedPrimitivesCount()This function returns the number of generated primitives during the traversal of the sub scene graph. NOTE: The returned value is undefined if the field queryGeneratedPrimitivesCount is not set to true.- Returns:
- The number of generated primitives.
-