SoVertexAttribFeedback Class Reference
[Groups]

VSG extension Node to record vertex attributes from shaders into buffer objects. More...

#include <Inventor/nodes/SoVertexAttribFeedback.h>

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

List of all members.

Public Types

enum  BufferMode {
  INTERLEAVED,
  SEPARATE
}
enum  PrimitiveType {
  LINES,
  POINTS,
  TRIANGLES
}

Public Member Functions

virtual SoType getTypeId () const
 SoVertexAttribFeedback ()
void registerFeedback (const SbString &varyingName, SoBufferObject *bufferObject, int primitiveSize=-1)
void unregisterFeedback (const SbString &varyingName)
int getGeneratedPrimitivesCount () const

Static Public Member Functions

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

Public Attributes

SoSFBool disableFragmentProcessing
SoSFBool autoResizeBuffers
SoSFBool queryGeneratedPrimitivesCount
SoSFEnum buffersMode
SoSFEnum primitiveType

Detailed Description

VSG extension Node to record vertex attributes from shaders into buffer objects.

This node is used to record selected vertex attributes for each primitive processed by the OpenGL system. The recorded vertex attributes may be stored in separate SoGpuBufferObjects or interleaved into a single buffer object.

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:

Limitations

FILE FORMAT/DEFAULT

ACTION BEHAVIOR

SEE ALSO

SoBufferObject, SoShaderProgram, SoBufferedShape

See related examples:

InterleavedVertexAttribFeedback, SimpleVertexAttribFeedback, VertexAttribFeedback


Member Enumeration Documentation

This enum is used by the field buffersMode to describe the data packing format in the buffer objects.

Enumerator:
INTERLEAVED 

All varyings are recorded, interleaved, in a single buffer object.

SEPARATE 

Each varying is recorded in a separate buffer object.

This enum is used to setup the expected recorded primitive type from the shaders.

Enumerator:
LINES 

The shader is supposed to generate LINES.

POINTS 

The shader is supposed to generate POINTS.

TRIANGLES 

The shader is supposed to generate TRIANGLES.


Constructor & Destructor Documentation

SoVertexAttribFeedback::SoVertexAttribFeedback (  ) 

Default constructor.


Member Function Documentation

static SoType SoVertexAttribFeedback::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoSeparator.

int SoVertexAttribFeedback::getGeneratedPrimitivesCount (  )  const

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.
virtual SoType SoVertexAttribFeedback::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoSeparator.

static SbBool SoVertexAttribFeedback::isSupported ( SoState state  )  [static]

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 see SoGLExtension for an example of using SoGLContext to avoid them.

Returns:
TRUE if vertex attributes feedback is supported.
void SoVertexAttribFeedback::registerFeedback ( const SbString varyingName,
SoBufferObject bufferObject,
int  primitiveSize = -1 
)

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.
void SoVertexAttribFeedback::unregisterFeedback ( const SbString varyingName  ) 

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.

Member Data Documentation

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.

The buffer mode used to record the primitives.

Use enum BufferMode. Default is SEPARATE.

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.

The type of primitive recorded during traversal.

Use enum PrimitiveType. Default is TRIANGLES.

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.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/