Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoBufferedShape Class Reference

VSG extension Node to render geometry stored in SoBufferObject objects. More...

#include <Inventor/nodes/SoBufferedShape.h>

+ Inheritance diagram for SoBufferedShape:

Public Types

enum  Type {
  POINTS ,
  LINE_STRIP ,
  LINE_LOOP ,
  LINES ,
  TRIANGLE_STRIP ,
  TRIANGLE_FAN ,
  TRIANGLES ,
  QUAD_STRIP ,
  QUADS ,
  POLYGON
}
 Type of shape that will be rendered. More...
 
enum  Usage {
  STATIC ,
  DYNAMIC
}
 This enum is used to set the shapeUsage field. More...
 
- Public Types inherited from SoShape
enum  ShapeType {
  POINTS ,
  LINES ,
  POLYGONS ,
  TEXT
}
 Basic type for antialiased rendering for this shape (Do not consider the SoDrawStyle property currently in the state). More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoBufferedShape ()
 Default constructor.
 
- Public Member Functions inherited from SoShape
virtual SbBool affectsState () const
 Overrides default method on SoNode.
 
ShapeType getShapeType ()
 Gets the current shape Full Scene Antialiasing type.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoShape
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SbBool isPrimitiveRestartAvailable (SoState *state=NULL)
 Returns TRUE if the primitive restart feature is available.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFEnum shapeUsage
 Defines the usage of the shape.
 
SoSFBool primitiveRestartEnabled
 Enable/disable the primitive restart feature.
 
SoSFInt32 primitiveRestartValue
 Index value for the primitive restart feature.
 
SoSFBool useNormalsGenerator
 Indicates if the node should use the internal normal vector generator if no normals are defined.
 
SoSFEnum shapeType
 Shape type to render.
 
SoMFInt32 numVertices
 Total number of vertices/indices or number of vertices/indices to be used per primitive.
 
SoSFBufferObject vertexBuffer
 Buffer object that contains the vertex data.
 
SoSFShort vertexComponentsCount
 Number of components in each vertex.
 
SoSFEnum vertexComponentsType
 SbDataType::DataType for vertices.
 
SoSFShort vertexStride
 Stride in bytes between the first component of two consecutive vertices.
 
SoSFInt32 vertexOffset
 Offset in bytes to the first vertex within the buffer.
 
SoSFBufferObject normalBuffer
 Buffer object that contains the (optional) normal vectors.
 
SoSFEnum normalComponentsType
 SbDataType::DataType type for the normal vectors.
 
SoSFShort normalStride
 Stride in bytes between the first component of two consecutive normals.
 
SoSFInt32 normalOffset
 Offset in bytes to the first normal vector in the buffer.
 
SoSFBufferObject indexBuffer
 Buffer object that contains the (optional) indices.
 
SoSFEnum indexType
 SbDataType::DataType type for the indices.
 
SoSFInt32 indexOffset
 Offset in bytes to the first index in the buffer.
 
SoSFBufferObject colorBuffer
 Buffer object that contains the (optional) color values.
 
SoSFEnum colorComponentsType
 SbDataType::DataType type for the color values.
 
SoSFInt32 colorStride
 Stride in bytes between the first component of two consecutive colors.
 
SoSFInt32 colorOffset
 Offset in bytes to the first color value in the buffer.
 
SoSFInt32 colorComponentsCount
 Number of components in each color value.
 
SoMFBufferObject texCoordsBuffer
 Buffer objects that contains the (optional) texture coordinates.
 
SoMFEnum texCoordsComponentsType
 SbDataType::DataType type for the texture coordinates.
 
SoMFInt32 texCoordsStride
 Stride in bytes between the first component of two consecutive texture coordinates.
 
SoMFInt32 texCoordsOffset
 Offset in bytes to the first texture coordinate in the buffer.
 
SoMFInt32 texCoordsComponentsCount
 Number of components in each texture coordinate.
 
- Public Attributes inherited from SoShape
SoSFBool boundingBoxIgnoring
 Whether to ignore this node during bounding box traversal.
 

Detailed Description

VSG extension Node to render geometry stored in SoBufferObject objects.

SoBufferedShape is useful to manage the rendering of large geometry, provide application control over where the data is stored (CPU or GPU) and to integrate rendering with the Open Inventor computing framework (through the SoBufferObject classes).

SoBufferedShape provides fields for:

  • Vertices
  • Indices (optional)
  • Colors (optional)
  • Normals (optional)
  • Texture coordinates (optional)

In this sense it is similar to the SoVertexProperty node, but SoVertexProperty is just a property node. SoBufferedShape also does the rendering of the shape. Properties that are not specified are taken from the traversal state (e.g. colors) or computed (e.g. normals).

SoBufferedShape can render many types of geometric primitives including points, lines, quads and triangles. (A single type must be specified per instance of SoBufferedShape.) You specify the type of primitive in the SoSFEnum field shapeType.

SoBufferedShape can render multiple primitives of the same type. You can specify the number of vertices (or indices if provided) to use for each primitive in the SoMFInt32 field numVertices (similar to SoFaceSet).

You can also use the primitive restart feature to define multiple indexed strip shapes, for example TRIANGLE_STRIP or LINE_STRIP. The end of each primitive is marked by a special index value in the index buffer and this value can be specified in the primitiveRestartValue field. The behavior is similar to the "-1" value that can be used in Open Inventor indexed shape nodes like SoIndexedFaceSet, but is implemented on the GPU.
NOTE:

The geometry and its attributes must be stored in buffer objects (see SoBufferObject). The buffer objects can be SoGpuBufferObjects stored directly on the graphics board or SoCpuBufferObjects stored in system memory. This allows the application to control what data is stored where.

In the general case, when the underlying buffer object is modified using the SoBufferObject API (setSize, map, memcpy, memset), the containing SoSFBufferObject field needs to be notified using touch() in order for Open Inventor to take this modification into account. If touch() is not called, there is no guarantee that the modifications will be visible on the next rendering.

If the application needs to frequently modify the values of an SoBufferObject, calling touch() on the field can result in an undesirable decrease in performance. Instead, it is recommended to use an instance of SoGpuBufferObject and set the shapeUsage field to DYNAMIC. These settings guarantee that this buffer data will be used directly for rendering, and eliminate the need to call touch() on the field. It also guarantees that modifications to the buffer done by shaders will be properly taken into account.

If lighting is enabled (there is no SoLightModel node or the model field of the SoLightModel is set to PHONG) and the normalBuffer field is not set, then Open Inventor will automatically compute normal vectors, but only in some cases (see Limitations section). Normal generation is affected by the creaseAngle field of the SoShapeHints node, but only if the vertices are NOT indexed (indexBuffer field is not set). If the vertices are indexed the creaseAngle is forced to PI, creating a smooth surface rendering. If the application needs to render sharp edges on a shape, either compute normal vectors and set the normalBuffer field or do not use the indexBuffer field. It is possible to disable normal generation (if for example the normals are generated by a geometry shader) by setting the useNormalsGenerator field to FALSE. If no normal vectors are specified or generated, and lighting is enabled, the primitive may not be rendered correctly.

SoBufferedShape provides fields to describe the content of each buffer, e.g. the data type and number of components in each buffer, as well as how to access the buffers, e.g. the offset into the buffer and "stride" separating data values in the buffer. The default values for offset and stride assume that the vertices, normals, etc are each in a separate buffer. However setting appropriate offset and stride allows, for example, vertices and normals to be interleaved in a single buffer. In this case the same buffer would be set into both the vertexBuffer and normalBuffer fields.

To disable computing the bounding box, which can take a long time with very large geometry, use the SoBBox node to specify a pre-computed bounding box.

Limitations

  • Transparency:
    If there is no color buffer, making the entire shape transparent using an SoMaterial node works as usual. However if there is a color buffer with RGBA values, note that Open Inventor does not currently check the color buffer for transparency (alpha values < 1). So in this case the SoBufferedShape will not be considered transparent geometry (even if there are alpha values < 1) and may not be rendered correctly. You can force Open Inventor to handle the shape as transparent geometry by putting an SoMaterial node with non-zero transparency before it in the scene graph.
  • Normal generation:
    If lighting is enabled and the normalBuffer field is not set, then Open Inventor will automatically compute normal vectors, but only in some cases. Automatic generation of normal vectors is ONLY enabled when:
    • The vertexComponentsCount field is set to 2 or 3,
    • The primitiveRestartEnabled field is set to FALSE (default), and
    • The primitives are TRIANGLES, TRIANGLE_STRIP or QUADS.
      Note: The crease angle (see SoShapeHints) is not used by the normal generator if the vertices are indexed. If the application needs to render sharp edges on a shape, either compute normal vectors and set the normalBuffer field or do not use the indexBuffer field.
  • SoGetPrimitiveCountAction:
    When using the primitive restart feature, the triangle/line count returned by the SoGetPrimitiveCountAction will not be accurate.
  • Concave polygons:
    Unlike (for example) SoFaceSet, SoBufferedShape does NOT automatically tesselate concave or complex polygons. Such primitives may not be rendered correctly.
  • SoWriteAction:
    SoBufferedShape can be saved to and restored from a .iv file just like any other Open Inventor node. However, during the read operation any GPU buffer objects (SoGpuBufferObject) in the file will be created as CPU buffers (SoCpuBufferObject).
  • Material binding (etc):
    SoBufferedShape effectively only supports per-vertex and per-vertex-indexed binding of materials, normals and texture coordinates using the values found in its own buffers.

Example using CPU buffer:

// Result should be similar to SoLineSet example in PG-GettingStarted.pdf.
// This example does not show any of the advantages of using SoBufferedShape,
// just the simplest possible setup and usage.
// Coordinate data
const float vertices[][3] = { 1,0.5,0, 0,1,0, -1,0.5,0,
-1,-1,0, 1,-1,0, 1,0,0, -1,0,0,
-1,-1.5,0, 1,-1.5,0 };
const int numVerts[] = {3, 4, 2};
const int NUM_COORDS = sizeof(vertices) / sizeof(SbVec3f);
const int NUM_COUNTS = sizeof(numVerts) / sizeof(int);
// Wrap coordinate array in a CPU buffer object
new SoCpuBufferObject( (void*)vertices, NUM_COORDS * sizeof(SbVec3f) );
// Create a buffered shape to render the geometry
pShape->numVertices.setValues( 0, NUM_COUNTS, numVerts );
pShape->vertexBuffer.setValue( vertBuf.ptr() );
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Node to render g...
SoMFInt32 numVertices
Total number of vertices/indices or number of vertices/indices to be used per primitive.
@ LINE_STRIP
Connects all the vertices to form a polyline.
SoSFBufferObject vertexBuffer
Buffer object that contains the vertex data.
SoBufferedShape()
Default constructor.
SoSFEnum shapeType
Shape type to render.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...
void setValues(int start, int num, const int32_t *newValues)
Sets num values starting at index start to the values.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
T * ptr() const
Cast to C pointer.
Definition SoRef.h:167
void setValue(SoBufferObject *newValue)
Sets this field to newValue.

Example using GPU buffer:

// Result should be similar to SoLineSet example in PG-GettingStarted.pdf.
// This example does not show any of the advantages of using SoBufferedShape,
// just the simplest possible setup and usage.
// Coordinate data
const float coords[][3] = { 1,0.5,0, 0,1,0, -1,0.5,0,
-1,-1,0, 1,-1,0, 1,0,0, -1,0,0,
-1,-1.5,0, 1,-1.5,0 };
const int numVerts[] = {3, 4, 2};
const int NUM_COORDS = sizeof(coords) / sizeof(SbVec3f);
const int NUM_COUNTS = sizeof(numVerts) / sizeof(int);
// Wrap coordinate array in a CPU buffer object
new SoCpuBufferObject( (void*)coords, NUM_COORDS * sizeof(SbVec3f) );
// Create a GPU (OpenGL) buffer and load data from CPU buffer
SoRef<SoGLContext> glContext = new SoGLContext(true);
glContext->bind();
gpuBuffer->setSize ( cpuBuffer->getSize() ); // Set the buffer size (allocate memory)
gpuBuffer->memcpy ( cpuBuffer.ptr() ); // Copy data into the buffer
glContext->unbind();
// Create a buffered shape node to render the geometry
pShape->numVertices.setValues( 0, NUM_COUNTS, numVerts );
pShape->vertexBuffer.setValue( gpuBuffer.ptr() );
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL context m...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> GPU buffer objec...
@ STATIC
The application will set the data once.
@ SHARED
The application will be writing data to the buffer, but will not read it.

LIMITATIONS: SoBufferedShape needs a graphic card supporting vertex buffer objects, if not available shape won't be rendered.

FILE FORMAT/DEFAULT

    BufferedShape {
    useNormalsGenerator TRUE
    shapeType TRIANGLES
    numVertices 0
    vertexBuffer NULL
    vertexComponentsCount 3
    vertexComponentsType SbDataType::FLOAT
    vertexStride 0
    vertexOffset 0
    normalBuffer NULL
    normalComponentsType SbDataType::FLOAT
    normalStride 3 * sizeof(float)
    normalOffset 0
    indexBuffer NULL
    indexType SbDataType::UNSIGNED_INT32
    indexOffset 0
    colorBuffer NULL
    colorComponentsType SbDataType::FLOAT
    colorStride 0
    colorOffset 0
    colorComponentsCount 3
    texCoordsBuffer NULL
    texCoordsComponentsType SbDataType::FLOAT
    texCoordsStride 0
    texCoordsOffset 0
    texCoordsComponentsCount 2
    primitiveRestartEnabled FALSE
    primitiveRestartValue -1
    }

ACTION BEHAVIOR

SEE ALSO

SoCpuBufferObject, SoGpuBufferObject, SoBBox

Definition at line 401 of file SoBufferedShape.h.

Member Enumeration Documentation

◆ Type

Type of shape that will be rendered.

Enumerator
POINTS 

Draws each vertex as a single point.

LINE_STRIP 

Connects all the vertices to form a polyline.

Given vertices A B C D, it draws the line segments AB, BC and CD.

LINE_LOOP 

Like LINE_STRIP, but an extra line segment is drawn connecting the last vertex to the first vertex.

LINES 

Connects each pair of vertices with a line.

Given vertices A B C D, it draws the line segments AB and CD.

TRIANGLE_STRIP 

Draws a strip of connected triangles.

Given vertices A B C D E F, it draws the triangles ABC, CBD, CDE and EDF.

TRIANGLE_FAN 

Draws a fan of triangles.

Given vertices A B C D E F, it draws the triangles ABC, ACD, ADE and AEF.

TRIANGLES 

Draws unconnected triangles.

Given vertices A B C D E F, it draws the triangles ABC and DEF.

QUAD_STRIP 

Draws a strip of connected quadrilaterals.

Given vertices A B C D E F, it draws the quadrilaterals ABDC and DCEF.

QUADS 

Draws unconnected quadrilaterals.

Given vertices A B C D E F G H, it draws the quadrilaterals ABCD and EFGH.

POLYGON 

Draws a single polygon using all the vertices (in each primitive).

Definition at line 413 of file SoBufferedShape.h.

◆ Usage

This enum is used to set the shapeUsage field.

Enumerator
STATIC 

The shape is static, its buffers are never modified or modified infrequently.

DYNAMIC 

The shape is dynamic, this will prevent some optimizations but it is recommended when the buffers are modified on a regular basis.

Definition at line 458 of file SoBufferedShape.h.

Constructor & Destructor Documentation

◆ SoBufferedShape()

SoBufferedShape::SoBufferedShape ( )

Default constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoBufferedShape::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoBufferedShape::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoShape.

Reimplemented in SoVolumeBufferedShape.

Member Data Documentation

◆ colorBuffer

SoSFBufferObject SoBufferedShape::colorBuffer

Buffer object that contains the (optional) color values.

Default is no buffer. Colors are always per-vertex or per-vertex-indexed. Note: This buffer must be an SoCpuBufferObject or SoGpuBufferObject. (SoGLBufferObject with target = ARRAY_BUFFER is also allowed but not recommended.)

Definition at line 652 of file SoBufferedShape.h.

◆ colorComponentsCount

SoSFInt32 SoBufferedShape::colorComponentsCount

Number of components in each color value.

Default is 3 (i.e. red, green and blue)

Definition at line 682 of file SoBufferedShape.h.

◆ colorComponentsType

SoSFEnum SoBufferedShape::colorComponentsType

SbDataType::DataType type for the color values.

Use enum SbDataType::DataType. Default is SbDataType::FLOAT.

Definition at line 658 of file SoBufferedShape.h.

◆ colorOffset

SoSFInt32 SoBufferedShape::colorOffset

Offset in bytes to the first color value in the buffer.

Default is 0.

Definition at line 676 of file SoBufferedShape.h.

◆ colorStride

SoSFInt32 SoBufferedShape::colorStride

Stride in bytes between the first component of two consecutive colors.


Default is 0. e.g: If the colors are composed of 3 float components the stride should be 3 * sizeof(float). If vertices are packed in the same buffer the stride should be 3 * sizeof(float) + 3 * sizeof(float), the second part stands for the extra data padding.

Note: When the values are packed (only color values in the buffer) the value 0 can be used and OpenGL will compute the stride value.

Definition at line 670 of file SoBufferedShape.h.

◆ indexBuffer

SoSFBufferObject SoBufferedShape::indexBuffer

Buffer object that contains the (optional) indices.

Default is no buffer. Note: This buffer must be an SoCpuBufferObject or SoGpuBufferObject. (SoGLBufferObject with target = ARRAY_BUFFER is also allowed but not recommended.)

Definition at line 630 of file SoBufferedShape.h.

◆ indexOffset

SoSFInt32 SoBufferedShape::indexOffset

Offset in bytes to the first index in the buffer.

Default is 0.

Definition at line 644 of file SoBufferedShape.h.

◆ indexType

SoSFEnum SoBufferedShape::indexType

SbDataType::DataType type for the indices.

Use enum SbDataType::DataType. Default is SbDataType::UNSIGNED_INT32. Note: Due to OpenGL restrictions, only 3 values are accepted here: SbDataType::UNSIGNED_INT32, SbDataType::UNSIGNED_BYTE or SbDataType::UNSIGNED_SHORT.

Definition at line 638 of file SoBufferedShape.h.

◆ normalBuffer

SoSFBufferObject SoBufferedShape::normalBuffer

Buffer object that contains the (optional) normal vectors.


Default is no buffer. Note: This buffer must be an SoCpuBufferObject or SoGpuBufferObject. (SoGLBufferObject with target = ARRAY_BUFFER is also allowed but not recommended.)

Definition at line 598 of file SoBufferedShape.h.

◆ normalComponentsType

SoSFEnum SoBufferedShape::normalComponentsType

SbDataType::DataType type for the normal vectors.

Use enum SbDataType::DataType. Default is SbDataType::FLOAT.

Definition at line 604 of file SoBufferedShape.h.

◆ normalOffset

SoSFInt32 SoBufferedShape::normalOffset

Offset in bytes to the first normal vector in the buffer.

Default is 0.

Definition at line 622 of file SoBufferedShape.h.

◆ normalStride

SoSFShort SoBufferedShape::normalStride

Stride in bytes between the first component of two consecutive normals.

Default is 0. e.g: If the normals are composed of 3 float components the stride should be 3 * sizeof(float). If RGB colors are packed in the same buffer the stride should be 3 * sizeof(float) + 3 * sizeof(float), the second part stands for the extra data padding.

Note: When the values are packed (only normals in the buffer) the value 0 can be used and OpenGL will compute the stride value.

Definition at line 616 of file SoBufferedShape.h.

◆ numVertices

SoMFInt32 SoBufferedShape::numVertices

Total number of vertices/indices or number of vertices/indices to be used per primitive.

Specifically:

  • For the shape types POINTS, LINES, TRIANGLES and QUADS
    Only the first value is meaningful and it specifies the number of vertices to be used for rendering. Specifically:
    • For a list of points: numVertices should be the number of points to be drawn.
    • For a list of lines: numVertices should be num_lines * 2 where num_lines is the number of lines to be drawn.
    • For a list of quadrangles: numVertices should be num_quads * 4 where num_quads is the number of quadrangles to be drawn.
    • For a list of triangles: numVertices should be num_tri * 3 where num_tri is the number of triangles to be drawn.
  • For all other types:
    The number of values in this field specifies the number of primitives that will be drawn.
    Each value in the field specifies the number of vertices (or indices if given) to be used for each primitive.

Definition at line 552 of file SoBufferedShape.h.

◆ primitiveRestartEnabled

SoSFBool SoBufferedShape::primitiveRestartEnabled

Enable/disable the primitive restart feature.

Default is FALSE. Primitive restart allows you to define multiple indexed strip shapes using only one index buffer. Each time the primitive restart index is reached a new strip or loop of primitives is emitted. This feature is similar to the "-1" that can be used in the OIV indexed shapes This also means that the availability must be checked before being used

Limitations: Enabling primitive restart disables the normal generator.

NOTE: field available since Open Inventor 8.5

Definition at line 505 of file SoBufferedShape.h.

◆ primitiveRestartValue

SoSFInt32 SoBufferedShape::primitiveRestartValue

Index value for the primitive restart feature.

Default is -1.

NOTE: field available since Open Inventor 8.5

Definition at line 513 of file SoBufferedShape.h.

◆ shapeType

SoSFEnum SoBufferedShape::shapeType

Shape type to render.

Use enum Type. Default is TRIANGLES.

Definition at line 533 of file SoBufferedShape.h.

◆ shapeUsage

SoSFEnum SoBufferedShape::shapeUsage

Defines the usage of the shape.

Some optimizations can be performed when we know the usage of the shape. Most of the time if the buffer objects attached to the shape are updated on a regular basis prefer using DYNAMIC, otherwise prefer STATIC.

STATIC provides the best performance when the content of the buffer is never modified or modified infrequently.

Use enum Usage. The default value is STATIC.

NOTE: field available since Open Inventor 9.2

Definition at line 489 of file SoBufferedShape.h.

◆ texCoordsBuffer

SoMFBufferObject SoBufferedShape::texCoordsBuffer

Buffer objects that contains the (optional) texture coordinates.


Default is no buffer. Note: This buffer must be an SoCpuBufferObject or SoGpuBufferObject. (SoGLBufferObject with target = ARRAY_BUFFER is also allowed but not recommended.)

Definition at line 690 of file SoBufferedShape.h.

◆ texCoordsComponentsCount

SoMFInt32 SoBufferedShape::texCoordsComponentsCount

Number of components in each texture coordinate.

Default is 2 (i.e. S and T)

Definition at line 720 of file SoBufferedShape.h.

◆ texCoordsComponentsType

SoMFEnum SoBufferedShape::texCoordsComponentsType

SbDataType::DataType type for the texture coordinates.

Use enum SbDataType::DataType. Default is SbDataType::FLOAT.

Definition at line 696 of file SoBufferedShape.h.

◆ texCoordsOffset

SoMFInt32 SoBufferedShape::texCoordsOffset

Offset in bytes to the first texture coordinate in the buffer.

Default is 0.

Definition at line 714 of file SoBufferedShape.h.

◆ texCoordsStride

SoMFInt32 SoBufferedShape::texCoordsStride

Stride in bytes between the first component of two consecutive texture coordinates.


Default is 0. e.g: If each element is composed of 2 float components the stride should be 2 * sizeof(float). If vertices are packed in the same buffer the stride should be 2 * sizeof(float) + 3 * sizeof(float), the second part stands for the extra data padding.

Note: When the values are packed (only texture coordinates in the buffer) the value 0 can be used and OpenGL will compute the stride value.

Definition at line 708 of file SoBufferedShape.h.

◆ useNormalsGenerator

SoSFBool SoBufferedShape::useNormalsGenerator

Indicates if the node should use the internal normal vector generator if no normals are defined.

Default is TRUE.

This mode is only supported for shapes with float coordinates and 3 components per vertex. It is not supported for the points and the lines.

Disabling the normal generator can be useful if the normals are computed in a shader or if the shaders don't need any normal at all.

Normal generation is affected by the creaseAngle field of SoShapeHints.

Definition at line 527 of file SoBufferedShape.h.

◆ vertexBuffer

SoSFBufferObject SoBufferedShape::vertexBuffer

Buffer object that contains the vertex data.


Default is no buffer. Note: This buffer must be an SoCpuBufferObject or SoGpuBufferObject. (SoGLBufferObject with target = ARRAY_BUFFER is also allowed but not recommended.)

Definition at line 560 of file SoBufferedShape.h.

◆ vertexComponentsCount

SoSFShort SoBufferedShape::vertexComponentsCount

Number of components in each vertex.

Default is 3 (i.e. X, Y and Z).

Definition at line 566 of file SoBufferedShape.h.

◆ vertexComponentsType

SoSFEnum SoBufferedShape::vertexComponentsType

SbDataType::DataType for vertices.

Use enum SbDataType::DataType. Default is SbDataType::FLOAT.

Definition at line 572 of file SoBufferedShape.h.

◆ vertexOffset

SoSFInt32 SoBufferedShape::vertexOffset

Offset in bytes to the first vertex within the buffer.

Default is 0.

Definition at line 590 of file SoBufferedShape.h.

◆ vertexStride

SoSFShort SoBufferedShape::vertexStride

Stride in bytes between the first component of two consecutive vertices.


Default is 0. e.g: If the vertices are composed of 3 float components the stride should be 3 * sizeof(float). If RGB colors are packed in the same buffer the stride should be 3 * sizeof(float) + 3 * sizeof(float), the second part stands for the extra data padding.

Note: When the values are packed (only vertices in the buffer) the value 0 can be used and OpenGL will compute the stride value.

Definition at line 584 of file SoBufferedShape.h.


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