Re: Putting attr list into geosets

New Message Reply Date view Thread view Subject view Author view

Nicolas Gauvin (nicolas++at++cae.ca)
Wed, 22 Jan 1997 10:54:59 -0500


On Jan 22, 3:14pm, Ming Wah wrote:
> Subject: Putting attr list into geosets
>
> Dear all,
> Does anybody know how to put a modified attr list into a geoset? I
> have obtained a copy of the coordinates and its normals and have
> transformed them and tried to put them back but the results were rubbish
> inside the geoset which causes a segmentation error. I used pfGSetAttr to
> put the list of attributes back.
>
-- End of excerpt from Ming Wah

You shouldn't need to call pfGSetAttr again to put the list back.
pfGetGSetAttrLists gives you the pointers to the actual list, not a copy of
them. Once you have the pointer, simply modify its content and thats it. The
geoset will be aware of the changes.

However the safest way to do this sort of thing is to use a pfCycleBuffer
for the attribute list you intend to modify. This way you will be frame
accurate when multiprocessing.

The man page of pfCycleBuffer contains a simple example for this:

          pfVec3 *prevVerts, *curVerts;

          pfInit();

          pfMultiprocess(mpMode);

          /*
           * This calls pfCBufferConfig() with the number of buffers
           * appropriate to the multiprocessing mode.
          */
          pfConfig();

          verts = pfNewCBuffer(sizeof(pfVec3) * numVerts, pfGetSharedArena());
          pfGSetAttr(gset, PFGS_COORD3, PFGS_PER_VERTEX, verts, NULL);

          while(!done)
          {
              curVerts = pfGetCurCBufferData(verts);

              /* Compute new positions of mass-spring system */
              for (i=0; i<numVerts; i++)
               curVerts[i] = prevVerts[i] + netForceVector * deltaTime;

              /* Indicate that 'verts' has changed */
              pfCBufferChanged(verts);

              prevVerts = curVerts;

              /* This calls pfCBufferFrame() */
              pfFrame();
          }

-- 
Nicolas Gauvin			CAE Electronics Ltd., 8585 Cote De Liesse
Software Developer 		Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications	tel: +1 514 341 2000 extension 2275
nicolas++at++cae.ca			fax: +1 514 340 5496
=======================================================================
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:54:25 PDT

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