From: Dorosky, Christopher G (christopher.g.dorosky++at++lmco.com)
Date: 04/08/2003 06:42:42
This is complicated.
You only need the pfFlux if you are not running APPCULLDRAW, ie you are
multiprocessing.
It is unsafe in that environment to change things because you might be in
the middle of drawing the geoset when you remove it in the app.
This is where the flux can save you.
There is an example in /usr/share/Performer/source/pguide/libpf/C++/ called
fluxed_gset or something like that.
This is difficult to work with when you are just starting, so work with some
easy examples first.
Chris
-----Original Message-----
From: J. Andreas Baerentzen [mailto:jab++at++imm.dtu.dk]
Sent: Monday, April 07, 2003 9:46 AM
To: 'info-performer++at++sgi.com'
Subject: [info-performer] Question pertaining to pfFlux and pfGeoBuilder
Hi,
I am trying to write a program which polygonizes an implicit surface,
producing a pfGeoSet from the polygons.
For each frame I change the implicit surface and update the pfGeoSet using a
pfdGeoBuilder. The new pfGeoSet is added to the appropriate geode and the
old
geoset is deleted using pfDelete.
This crashes.
I assume it crashes because it is dangerous to modify geometry unless the
pfFlux functionality is used to make things safe?
I assume again that one needs to use a pfFlux to get the memory for the
pfGeoSet?!
There are some pfFlux examples, (e.g. pfluxed_gset.C) but I am still not
quite
sure how to use the pfFlux memory in concert with a pfdGeoBuilder. Mostly
this is because the examples allocate memory for the fluxed gset and then
change it. Since I am using a builder, I simply get a list of gsets using
pfdBuildGSets(bldr) ... so then what ?! Do I copy to a fluxed pfGeoSet?!
Using pfCopy?!
If anyone has an example illustrating how to use fluxes with geobuilder, I'd
be most grateful if it could be posted to this list or sent to jab 'at'
imm.dtu.dk
Thanks!
Andreas
ps: I include the code for reference
Here I create the pfGeoSet
------------------------------------
pfGeoSet* create()
{
pfVec3* vertices = 0;
vector<ushort> indices(0);
Morph t;
Polygonizer pol(&t, 0.2, 15);
pol.march(NOTET, 0.,0.,0.);
// Create primitive, add pointer to vertices.
pfdPrim *prim = new pfdPrim;
prim->flags = 0;
prim->coordList=
reinterpret_cast<pfVec3*>(&pol.get_vertex(0));
prim->normList =
reinterpret_cast<pfVec3*>(&pol.get_normal(0));
prim->nbind = PFGS_PER_VERTEX;
prim->cbind = PFGS_OFF;
for(int t=0 ; t < PF_MAX_TEXTURES ; ++t)
prim->tbind[t] = PFGS_OFF;
// Create builder
pfdGeoBuilder *bldr = pfdNewGeoBldr();
for(int i=0;i<pol.no_triangles();++i)
{
TRIANGLE t = pol.get_triangle(i);
prim->icoords[0] = t.v0;
prim->icoords[1] = t.v1;
prim->icoords[2] = t.v2;
prim->inorms[0] = t.v0;
prim->inorms[1] = t.v1;
prim->inorms[2] = t.v2;
pfdAddIndexedTri(bldr, prim);
}
// generate optimized triangle mesh GeoSet
const pfList* gsetList = pfdBuildGSets(bldr);
pfGeoSet* gs = static_cast<pfGeoSet*>(gsetList->get(0));
// release pfdGeoBuilder and pfdGeom storage
pfdDelGeoBldr(bldr);
pfDelete(prim);
return gs;
}
Here is the loop:
------------------------
while (true)
{
pfuGetMouse(&mouse);
pfuGetEvents(&events);
handleEvents(events);
if(model->getNumGSets()>0)
{
pfGeoSet *gset = model->getGSet(0);
model->removeGSet(gset);
pfDelete(gset);
}
pfGeoSet* gset = create();
model->addGSet(gset);
xformer->update();
pfSync();
pfFrame();
}
-----------------------------------------------------------------------
List Archives, Info, FAQ: http://www.sgi.com/software/performer/
Open Development Project: http://oss.sgi.com/projects/performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
-----------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Apr 08 2003 - 07:18:30 PDT