Help for Indexed LineSet

New Message Reply Date view Thread view Subject view Author view

IRIS Performer user group (perfers++at++teil.soft.net)
Thu, 19 Jun 1997 16:50:07 -0530 (IST)


Hi Performers,

 we have been using the following code for creating
 indexed lineset without getting the desired result.
 when we specify NULL for the indexed lists the output
 will be correct (a square polyline).
 when we specify the indexedlist(also in sequence)
 the out put will be different.

 PLEASE HELP !

 Thanks in Advance .

    // Indexed LineSet

    pfVec3* coords=(pfVec3*)pfMalloc(sizeof(pfVec3)*4,pfGetSharedArena()) ;
    pfVec3* colors=(pfVec3*)pfMalloc(sizeof(pfVec3)*4,pfGetSharedArena()) ;
    int coordIndex[4] ;
    int colorIndex[4] ;
    pfGeoSet * gset = new pfGeoSet ;

    gset->setPrimType(PFGS_LINESTRIPS) ;
    gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coords,(ushort*)coordIndex);
    gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX, colors,(ushort*)colorIndex);

    // Setting coordinates
    coords[0].set(-1.0f, -1.0f, 0.0f );
    coords[1].set( 1.0f, -1.0f, 0.0f );
    coords[2].set( 1.0f, 1.0f, 0.0f );
    coords[3].set(-1.0f, 1.0f, 0.0f );

    // Setting coordinate indexes
    for(int i = 0;i < 4;i++)
        coordIndex[i] = i ;

    // Setting colors
    colors[0].set(1.0f, 1.0f, 1.0f);
    colors[1].set(0.0f, 0.0f, 1.0f);
    colors[2].set(1.0f, 0.0f, 0.0f);
    colors[3].set(0.0f, 1.0f, 0.0f);

    // Setting color indexes
    for(i = 0;i < 4;i++)
        colorIndex[i] = i ;

    gset->setNumPrims(1);
    gset->setLineWidth(2) ;

    int noOfCoord = pfGetSize(coords) / sizeof(pfVec3) ;
    int *lens = (int*) pfMalloc(sizeof(int), pfGetSharedArena());
    lens[0] = nCoord ;
    gset->setPrimLengths(lens) ;

    /////////////////////////////
  

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:28 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.