Mario Veraart (rioj7++at++fel.tno.nl)
Mon, 28 Jul 1997 11:20:26 +0200 (MET DST)
This will allocate for every separate process a block of memory with
size nSph * sizeof(pfVec4). The cycle buffer keeps an array of pointers to
these blocks of memory allocated in shared memory.
>
> line 137: Get a handle to the data buffer:
> Note: I believe any time get data is called it gets a version
> of the data appropriate to which process you are in (APP, CULL,
> DRAW) and which pfMultiprocessing mode you are in (e.g.,
> PFMP_APP_CULL_DRAW)
>
> pfVec4 *colors = (pfVec4*) cbuf->getData();
>
> Again in answer to one of your questions this returns a POINTER
> to the buffer that was allocated in line 132. You still need to
> set the data as below.
Every process has a global variable that contains the number of the buffer
in a cyclebuffer to use for this process.
This variable is updates during pfSync/pfFrame.
In all the processes the value is different. So cbuf->getData() checks the
needed buffer number and returns the pointer to the right buffer.
>
> line 159-160: Set the colors and hence the cbuf data:
>
> colors[i].set(0.0f, 0.0f, 0.0f, 1.0f);
> colors[i][max] = 1.0f;
>
> line 178:. Initialize all the other CycleBuffer copies of this buffer:
>
> /* Set all pfCycleMemories to the same colors */
> cbuf->init(cbuf->getData());
>
> line 180: Associate this cycle buffer data with the color data of the
> pfGeoSet:
>
> gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX,
> (void*)cbuf, NULL);
>
> Now you can change your color in the APP process as shown in the
> breatheMorphe function:
>
> colors = (pfVec4*) cbuf->getData();
> for (int i=0; i<nSph; i++)
> colors[i][0] = s;
>
> cbuf->changed();
>
> And these changes will get propagated down the pipeline AUTOMAGICALLY by
> the pfCycleBuffer, and if I understand this correctly... when the draw
> process comes along to render the pfGeoSet and accesses the color
> information. The pfCycleBuffer will feed it a pointer to the "correct"
> data.
>
> Hope this is right,
Yes you are
> scott
Mario
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:39 PDT