Angel-Ventura Mendo Gomez (ventura++at++labri.u-bordeaux.fr)
Tue, 11 May 1999 15:49:21 +0200
The problem is that if you use Multiprocesing you must allocate the
pfGeoSet in the
shared Arena and also the vertex array ex :
pfGeoSet *
GeoSetEditor::makeGeoSet(void *arena)
{
pfVec3 *coords;
pfVec4 *colors;
coords = (pfVec3 *)pfMalloc(sizeof(pfVec3)*VERTEX_NUMBER,arena);
coords[0].set(-2.0f, -2.0f, 2.0f );
coords[1].set( 2.0f, -2.0f, 2.0f );
coords[2].set( 2.0f, 2.0f, 2.0f );
coords[3].set(-2.0f, 2.0f, 2.0f );
colors = (pfVec4 *)pfMalloc(sizeof(pfVec4)*VERTEX_NUMBER,arena);
colors[0].set(1.0f, 1.0f, 1.0f, 1.0f);
colors[1].set(0.0f, 0.0f, 1.0f, 1.0f);
colors[2].set(1.0f, 0.0f, 0.0f, 1.0f);
colors[3].set(0.0f, 1.0f, 0.0f, 1.0f);
pfGeoSet gset = new(arena) pfGeoSet();
gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coords, NULL);
gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX, colors, NULL);
gset->setPrimType(PFGS_QUADS);
gset->setNumPrims(1);
return gset;
}
and now the main :
void
main(void)
{
.......
pfConfig();
sharedData->geoSet=makeGeoSet(pfGetSharedArena());
......
sharedData->chanel = new pfChannel(p);
sharedData->chanel->setChanData(&sharedData, sizeof(SharedData *));
sharedData->chanel->passChanData();
sharedData->chanel->setTravFunc(PFTRAV_DRAW,DrawChannel);
ect ...
while (1){
...
}
}
static void
DrawChannel (pfChannel *, void *userData)
{
SharedData **ptr=(SharedData **)userData;
SharedData *sharedData=(*ptr);
static int i=0;
static pfVec4 clr[] = { pfVec4(1.0f, 0.0f, 0.0f, 1.0f),
pfVec4(0.0f, 0.0f, 1.0f, 1.0f) };
// erase framebuffer and draw Earth-Sky model
pfClear(PFCL_COLOR | PFCL_DEPTH, &clr[i]);
i^=1;
// invoke Performer draw-processing for this frame
pfDraw();
// drawing pfGeoSet
sharedData->geoSet->draw();
}
Et voila ;-)
Good Luck
-- ventura++at++labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~ventura telephone 05.56.84.69.20Quod natura non dat Salmantica non praestat.
This archive was generated by hypermail 2.0b2 on Tue May 11 1999 - 06:51:58 PDT