Re: Help for Indexed LineSet

New Message Reply Date view Thread view Subject view Author view

Ran Yakir (rany++at++rtset.co.il)
Fri, 20 Jun 1997 05:16:00 +0300


The index list should also be allocated from the shared arena using
pfMalloc(). Also, the indexes sould be of tyep ushort and not int. If
you are not multiprocessing, then youhave static arrays for the indexes,
but still, sending ints will result in the wrong look.

Ran

> 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

--
 __                                  | Ran Yakir
 /_)  _  __   \  / _   / o __        | 28 Ben Gurion St.
/ )_ (_(_) )   \/ (_(_/<_(_)(        | Hod Hasharon 54200
              _/                     | Israel
-------------------------------------+--------------------------------
At Home :                            | At Work :
                                     |   RT-SET
  Voice  : +972-9-7489974            |   Voice  : +972-9-9552236
  Fax    : +972-9-7422149            |   Fax    : +972-9-9552239
  E-mail : rany++at++netvision.net.il     |   E-mail : rany++at++rtset.co.il

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