5.6. Additional Shapes

Figure 5.28. MarkerSet node class


The marker node, SoMarkerSet( C++ | Java | .NET ), represents a set of bitmaps located at the coordinates specified by the vertexProperty field (from SoVertexShape( C++ | Java | .NET ) ) or the current inherited coordinates. For optimal performance, use of the vertexProperty field is recommended.

SoMarkerSet( C++ | Java | .NET ) uses the coordinates in order, starting with the first. The number of markers in the set is specified by the numPoints field. The coordinates of the marker set are transformed by the current cumulative transformation.

You set the bitmap to be drawn at each point using the field markerIndex, which indexes into the list of defined bitmaps. The enumeration SoMarkerSet::MarkerType defines the list of predefined markers.

Defining new markers:

The following method allows users to add new markers which are not available in the list of predefined markers:


C++
void addMarker(int markerIndex, 
               const SbVec2s &size, 
               const unsigned char *bytes, 
               SbBool isLSBFirst = TRUE, 
               SbBool isUpToDown = TRUE)
  

.NET
void AddMarker(int markerIndex,
               SbVec2s size,
               byte[] bytes,
               bool isLSBFirst,
               bool isUpToDown)
  

Java
void addMarker(int markerIndex,
	           SbVec2s size,
	           byte[] bytes,
	           boolean isLSBFirst,
	           boolean isUpToDown)

markerIndex is the index of the new marker (if this marker already exists, it is replaced by the new one), size is the width and height of the bitmap in pixels, and bytes is the array containing the bitmap. The bitmap is arranged row-by-row, from left to right, and down to up (or up to down according to the parameter isUpToDown). Each byte corresponds to eight pixels.

If isLSBFirst is TRUE, bits are ordered within a byte from least significant to most significant; otherwise the first bit in each byte is the most significant one. If isUpToDown is TRUE, the marker bitmap is described from up to down (that is bytes [0] is the left top corner of the bitmap), otherwise from down to up (that is bytes [0] is the bottom left corner).

Example 5.10. How to use SoMarkerSet

This example displays a marker set composed of predefined markers and new markers using the SoMarkerSet( C++ | Java | .NET )node. The source code is available in:

$OIVHOME/examples/source/Inventor/examples/Features/MarkerSet/markerSet.cxx


C++
int
main(int argc, char **argv)
{
  // Initialize Inventor and Xt
  Widget myWindow = SoXt::init(argv[0]);

  // Array containing the coordinates
  // of the markers.
  SbVec3f markersCoords[NUM_MARKERS]=
    {
    SbVec3f(0.5,0.5,0), SbVec3f(1.5,3.8,0), SbVec3f(1.8,1.2,0), SbVec3f(2.4,1.9,0),
      SbVec3f(3.2,6.3,0), SbVec3f(4.5,7.2,0), SbVec3f(6.3,9.3,0), SbVec3f(6.9,7.2,0),
      SbVec3f(8.0,6.0,0), SbVec3f(8.5,6.3,0)
    };
  };

  // Array containing the colors of the markers.
  SbColor markersColors[NUM_MARKERS]=
    {
    SbColor(1,0,0), SbColor(0,1,0), SbColor(0,0,1), SbColor(1,1,1), SbColor(1,1,0),
      SbColor(1,0,1), SbColor(0,1,1), SbColor(1,0,0), SbColor(0,1,0), SbColor(0,0,1)
    };
  };

  // Array containing the indices of the markers.
  int markersIndexes[NUM_MARKERS]=
    {
    90, 91, 92, SoMarkerSet::CIRCLE_FILLED_9_9,
      SoMarkerSet::SQUARE_FILLED_9_9,
      SoMarkerSet::DIAMOND_FILLED_9_9, SoMarkerSet::TRIANGLE_FILLED_9_9,
      SoMarkerSet::RHOMBUS_FILLED_9_9, SoMarkerSet::HOURGLASS_FILLED_9_9
    };

  // Array containing a new marker "arrow"
  static unsigned char arrowBits[] =
  {
  0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00,
    0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff,
    0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff,
    0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01,
    0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
    0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00,
    0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff,
    0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff,
    0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01,
    0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
    0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe,
    0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff,
    0xff, 0x0f, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff,
    0x01, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00,
    0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00
  };
  // Array containing a new marker "target"
  static unsigned char targetBits[] =
  {
  0xe0, 0x0f, 0x00, 0x18, 0x31, 0x00, 0x04, 0x41, 0x00, 0xc2, 0x87,
    0x00, 0x22, 0x89, 0x00, 0x11, 0x11, 0x01, 0x09, 0x21, 0x01, 0x09,
    0x21, 0x01, 0xff, 0xff, 0x01, 0x09, 0x21, 0x01, 0x09, 0x21, 0x01,
    0x11, 0x11, 0x01, 0x22, 0x89, 0x00, 0xc2, 0x87, 0x00, 0x04, 0x41,
    0x00, 0x18, 0x31, 0x00, 0xe0, 0x0f, 0x00
  };

  // Array containing a new marker "tgs"
  static unsigned char tgsBits[] =
  {
  0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x04, 0x11,
    0x11, 0x04, 0x01, 0x01, 0x04, 0x1d, 0x1f, 0x04, 0x11, 0x10, 0x04,
    0x11, 0x11, 0x04, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f
  };

  // Add the new markers.
  SoMarkerSet::addMarker(90, SbVec2s(17, 17), targetBits);
  SoMarkerSet::addMarker(91, SbVec2s(33, 33), arrowBits);
  SoMarkerSet::addMarker(92, SbVec2s(21, 11), tgsBits);

  SoSeparator *root = new SoSeparator;

  root->ref();

  // Sets the coordinates of the markers.
  SoCoordinate3 *coords = new SoCoordinate3;
  coords->point.setValues(0, NUM_MARKERS, markersCoords);

  // Sets the indices of the markers.
  SoMarkerSet *markerSet = new SoMarkerSet;
  markerSet->markerIndex.setValues(0, NUM_MARKERS, markersIndexes);

  SoMaterialBinding *matBind = new SoMaterialBinding;
  matBind->value = SoMaterialBinding::PER_VERTEX;

  // Sets the color of the markers.
  SoMaterial *mat = new SoMaterial;
  mat->diffuseColor.setValues(0, NUM_MARKERS, markersColors);

  root->addChild(coords);
  root->addChild(new SoLineSet);
  root->addChild(matBind);
  root->addChild(mat);
  root->addChild(markerSet);

  // Create a viewer
  SoXtExaminerViewer *myViewer;
  myViewer = new SoXtExaminerViewer(myWindow);

  // Attach and show viewer
  myViewer->setSceneGraph(root);
  myViewer->setTitle("Marker");
  myViewer->setSize(SbVec2s(554, 380));

  myViewer->show();
  myViewer->viewAll();

  // Loop forever
  SoXt::show(myWindow);
  SoXt::mainLoop();
  return 0;
}
    

.NET
// Array containing the coordinates of the markers.
SbVec3f[] markersCoords = new SbVec3f[NUM_MARKERS]
{
  new SbVec3f(0.5f, 0.5f, 0.0f), new SbVec3f(1.5f, 3.8f, 0.0f), 
  new SbVec3f(1.8f, 1.2f, 0.0f), new SbVec3f(2.4f, 1.9f, 0.0f), 
  new SbVec3f(3.2f, 6.3f, 0.0f), new SbVec3f(4.5f, 7.2f, 0.0f),
  new SbVec3f(6.3f, 9.3f, 0.0f), new SbVec3f(6.9f, 7.2f, 0.0f), 
  new SbVec3f(8.0f, 6.0f, 0.0f), new SbVec3f(8.5f, 6.3f, 0.0f)
};

// Array containing the colors of the markers.
SbColor[] markersColors = new SbColor[NUM_MARKERS]
{
  new SbColor(1,0,0), new SbColor(0,1,0), 
  new SbColor(0,0,1), new SbColor(1,1,1), 
  new SbColor(1,1,0), new SbColor(1,0,1), 
  new SbColor(0,1,1), new SbColor(1,0,0), 
  new SbColor(0,1,0), new SbColor(0,0,1)
};

// Array containing the indices of the markers.
int[] markersIndexes = new int[NUM_MARKERS]
{
  90, 91, 92, (int)SoMarkerSet.MarkerTypes.CIRCLE_FILLED_9_9,
  (int)SoMarkerSet.MarkerTypes.SQUARE_FILLED_9_9,
  (int)SoMarkerSet.MarkerTypes.DIAMOND_FILLED_9_9,
  (int)SoMarkerSet.MarkerTypes.TRIANGLE_FILLED_9_9,
  (int)SoMarkerSet.MarkerTypes.RHOMBUS_FILLED_9_9,
  (int)SoMarkerSet.MarkerTypes.HOURGLASS_FILLED_9_9, 0
};

// Array containing a new marker ()"arrow"
byte[] arrowBits = new byte[]
{
  0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff,
  0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01,
  0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00,
  0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff,
  0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
  0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff,
  0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01,
  0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00,
  0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff,
  0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0x01,
  0xfe, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff,
  0xff, 0x0f, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01,
  0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00,
  0xe0, 0x07, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00
};

// Array containing a new marker ()"target"
byte[] targetBits = new byte[]
{
  0xe0, 0x0f, 0x00, 0x18, 0x31, 0x00, 0x04, 0x41, 0x00, 0xc2, 0x87, 0x00,
  0x22, 0x89, 0x00, 0x11, 0x11, 0x01, 0x09, 0x21, 0x01, 0x09, 0x21, 0x01,
  0xff, 0xff, 0x01, 0x09, 0x21, 0x01, 0x09, 0x21, 0x01, 0x11, 0x11, 0x01,
  0x22, 0x89, 0x00, 0xc2, 0x87, 0x00, 0x04, 0x41, 0x00, 0x18, 0x31, 0x00,
  0xe0, 0x0f, 0x00
};

// Array containing a new marker ()"tgs"
byte[] tgsBits = new byte[]
{
  0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x04, 0x11, 0x11,
  0x04, 0x01, 0x01, 0x04, 0x1d, 0x1f, 0x04, 0x11, 0x10, 0x04, 0x11, 0x11,
  0x04, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f
};

// Add the new markers.
SoMarkerSet.AddMarker(90, new SbVec2s(17, 17), targetBits);
SoMarkerSet.AddMarker(91, new SbVec2s(33, 33), arrowBits);
SoMarkerSet.AddMarker(92, new SbVec2s(21, 11), tgsBits);

SoSeparator root = new SoSeparator();


// Sets the coordinates of the markers.
SoCoordinate3 coords = new SoCoordinate3();
coords.point.SetValues(0, markersCoords);

// Sets the indices of the markers.
SoMarkerSet  markerSet = new SoMarkerSet();
markerSet.markerIndex.SetValues(0, markersIndexes);

SoMaterialBinding matBind = new SoMaterialBinding();
matBind.value.SetValue((int)SoMaterialBinding.Bindings.PER_VERTEX);

// Sets the color of the markers.
SoMaterial mat = new SoMaterial();
mat.diffuseColor.SetValues(0, markersColors);

root.AddChild(coords);
root.AddChild(new SoLineSet());
root.AddChild(matBind);
root.AddChild(mat);
root.AddChild(markerSet);

// Create a viewer
SoWinExaminerViewer myViewer;
myViewer = new SoWinExaminerViewer(this, "", true, 
          SoWinFullViewer.BuildFlags.BUILD_ALL, SoWinViewer.Types.BROWSER);


// attach and show viewer   
myViewer.SetSceneGraph(root);
myViewer.SetTitle("Marker");
//myViewer.SetSize(SbVec2s(554, 380));

myViewer.Show();
myViewer.ViewAll();
    

Java
static SbVec3f markersCoords[] = {
  new SbVec3f(0.5f,0.5f,0.f), new SbVec3f(1.5f,3.8f,0.f), new SbVec3f(1.8f,1.2f,0.f),
  new SbVec3f(2.4f,1.9f,0.f), new SbVec3f(3.2f,6.3f,0.f), new SbVec3f(4.5f,7.2f,0.f),
  new SbVec3f(6.3f,9.3f,0.f), new SbVec3f(6.9f,7.2f,0.f), new SbVec3f(8.0f,6.0f,0.f),
  new SbVec3f(8.5f,6.3f,0.f)
};

static SbColor markersColors[] = {
  new SbColor(1,0,0), new SbColor(0,1,0), new SbColor(0,0,1),
  new SbColor(1,1,1), new SbColor(1,1,0), new SbColor(1,0,1),
  new SbColor(0,1,1), new SbColor(1,0,0), new SbColor(0,1,0),
  new SbColor(0,0,1)
};

static byte arrowBits[] = {
  (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00,
  (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff,
  (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff,
  (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01,
  (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00,
  (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00,
  (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff,
  (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff,
  (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01,
  (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00,
  (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00,
  (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff,
  (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff,
  (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01,
  (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00,
  (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00,
  (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff,
  (byte)0xff, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff,
  (byte)0x01, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
  (byte)0x01, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x01,
  (byte)0xfe, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00, (byte)0xf8,
  (byte)0xff, (byte)0xff, (byte)0x3f, (byte)0x00, (byte)0xe0, (byte)0xff,
  (byte)0xff, (byte)0x0f, (byte)0x00, (byte)0xc0, (byte)0xff, (byte)0xff,
  (byte)0x03, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x01,
  (byte)0x00, (byte)0x00, (byte)0xfc, (byte)0x7f, (byte)0x00, (byte)0x00,
  (byte)0x00, (byte)0xf8, (byte)0x1f, (byte)0x00, (byte)0x00, (byte)0x00,
  (byte)0xe0, (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80,
  (byte)0x01, (byte)0x00, (byte)0x00
};

static byte targetBits[] = {
  (byte)0xe0, (byte)0x0f, (byte)0x00, (byte)0x18, (byte)0x31, (byte)0x00,
  (byte)0x04, (byte)0x41, (byte)0x00, (byte)0xc2, (byte)0x87, (byte)0x00,
  (byte)0x22, (byte)0x89, (byte)0x00, (byte)0x11, (byte)0x11, (byte)0x01,
  (byte)0x09, (byte)0x21, (byte)0x01, (byte)0x09, (byte)0x21, (byte)0x01,
  (byte)0xff, (byte)0xff, (byte)0x01, (byte)0x09, (byte)0x21, (byte)0x01,
  (byte)0x09, (byte)0x21, (byte)0x01, (byte)0x11, (byte)0x11, (byte)0x01,
  (byte)0x22, (byte)0x89, (byte)0x00, (byte)0xc2, (byte)0x87, (byte)0x00,
  (byte)0x04, (byte)0x41, (byte)0x00, (byte)0x18, (byte)0x31, (byte)0x00,
  (byte)0xe0, (byte)0x0f, (byte)0x00
};

static byte tgsBits[] = {
  (byte)0xff, (byte)0xff, (byte)0x1f, (byte)0x00, (byte)0x00, (byte)0x00,
  (byte)0x1f, (byte)0x1f, (byte)0x1f, (byte)0x04, (byte)0x11, (byte)0x11,
  (byte)0x04, (byte)0x01, (byte)0x01, (byte)0x04, (byte)0x1d, (byte)0x1f,
  (byte)0x04, (byte)0x11, (byte)0x10, (byte)0x04, (byte)0x11, (byte)0x11,
  (byte)0x04, (byte)0x1f, (byte)0x1f, (byte)0x00, (byte)0x00, (byte)0x00,
  (byte)0xff, (byte)0xff, (byte)0x1f
};

static {
  SoMarkerSet.addMarker(90, new SbVec2s((short) 17, (short) 17), targetBits, true,true) ;
  SoMarkerSet.addMarker(91, new SbVec2s((short) 33, (short) 33), arrowBits, true,true) ;
  SoMarkerSet.addMarker(92, new SbVec2s((short) 21, (short) 11), tgsBits, true,true) ;
}

...

SoCoordinate3 coords = new SoCoordinate3() ;
coords.point.setValues(0, markersCoords) ;

markerSet = new SoMarkerSet() ;
markerSet.markerIndex.setValue(0) ;

SoMaterialBinding matBind = new SoMaterialBinding();
matBind.value.setValue(SoMaterialBinding.Bindings.PER_VERTEX);

SoMaterial mat = new SoMaterial() ;
mat.diffuseColor.setValues(0, markersColors);

// Create the root of the scene graph
SoSeparator root = new SoSeparator();
{ //assemble scene graph
  root.addChild(coords);
  root.addChild(new SoLineSet());
  root.addChild(matBind);
  root.addChild(mat);
  root.addChild(markerSet);
}

SwSimpleViewer viewer = new SwSimpleViewer(SwSimpleViewer.EXAMINER);
viewer.setSceneGraph(root) ;
viewer.viewAll();

The purpose of the node SoBufferedShape( C++ | Java | .NET ) is 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( C++ | Java | .NET ) classes). SoBufferedShape( C++ | Java | .NET ) provides fields for:

  • Vertices

  • Indices (optional)

  • Colors (optional)

  • Normals (optional)

  • Texture coordinates (optional)

In this sense it is similar to the SoVertexProperty( C++ | Java | .NET ) node, but SoVertexProperty( C++ | Java | .NET ) is just a property node. SoBufferedShape( C++ | Java | .NET ) 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( C++ | Java | .NET ) can render multiple geometric primitives of the same type. You specify the number of vertices (or indices if provided) to use for each primitive in the SoMFInt32( C++ | Java | .NET ) field primitiveCount. SoBufferedShape( C++ | Java | .NET ) can render many types of geometric primitives. You specify the type of primitive in the SoSFEnum( C++ | Java ) field shapeType:

  • POINTS

    Draws each vertex as a single point.

  • LINES

    Connects every other pair of vertices with a line. Given vertices A B C D, it draws the line segments AB and CD.

  • LINE_STRIP

    Connects every pair of vertices with a line, i.e. 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.

  • TRIANGLES

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

  • 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.

  • QUADS

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

  • QUAD_STRIP

    Draws a strip of connected quadrilaterals. Given vertices A B C D E F, it draws the quadrilaterals ABCD and CDFE.

  • POLYGON

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

The geometry and its attributes must be stored in buffer objects (See Chapter 24, Open Inventor Computing framework for more information). The buffer objects can be SoGLBufferObjectsstored directly on the graphics board or SoCpuBufferObjects stored in system memory. This allows the application to control what data is stored where SoBufferedShape( C++ | Java | .NET ) provides fields to describe the content of the buffers, 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.

Examples:

Figure 5.29. Extrusion class


Open Inventor provides support for one extrusion node: SoExtrusion( C++ | Java | .NET ) , which was added in Open Inventor 5.0. It is used for creating geometric shapes based on a two-dimensional cross section extruded along a three-dimensional spine. The cross section can be scaled and rotated at each spine point to produce a wide variety of shapes.

SoExtrusion( C++ | Java | .NET ) has the following fields:

Example 5.11. Using SoExtrusion to do a well-bore plot

An example program showing the use of SoExtrusion( C++ | Java | .NET ) to do a well-bore plot is provided in

$OIVHOME/examples/source/Inventor/examples/Techniques/WellBore