From: Guenter Schreiber (Guenter.Schreiber++at++dlr.de)
Date: 02/20/2002 00:22:52
Hello pfGurus,
Currently I am facing the problem, that I want to change the number
of vertexes in a linestrip dynamically.
That means, I obtain in my application a bunch of coordinates,
which I want to display as a linestripset.
Everything works fine as long as the number of coordinates is
increasing.
But unfortunately,
as this number decreases, the old lineset continues beeing displayed.
What do I have to change ?
/* Initialization */
gset->setNumPrims(0);
coordData = (pfVec3*) pfMalloc (sizeof(pfVec3) *
_allocatedSizeOfCoordinates,
pfGetSharedArena());
pfGeoState *gstate = new pfGeoState;
// gstate->setMode(PFSTATE_CULLFACE, PFCF_OFF);
gset->setGState(gstate);
// Add the geometry child
//
color = new pfVec4;
gset->setLineWidth(4); // thick line
pfGeode * newGeode = new pfGeode;
newGeode -> addGSet(gset);
newGeode -> setName("GEO_VRCoordinateGeode");
ilist = (int*)pfMalloc(sizeof(int)*2, pfGetSharedArena());
/* */
/* in the Application */
/* in numVals is the proper number of coordinates
which are put to coordData */
int numVals = dataSource -> getCoordinates( shmData,
coordData
,
_allocatedSizeOfCoordinates
);
if (numVals >0)
{
gset->setPrimType(PFGS_FLAT_LINESTRIPS);
gset->setNumPrims(1);
ilist[0] = numVals;
ilist[1] = numVals-_allocatedSizeOfCoordinates-1;
gset -> setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coordData,
NULL);
gset -> setPrimLengths(ilist);
switch(index %3)
{
case 0:
color->set(1.0f, 0.f, 0.f, 1.0f);
break;
case 1:
color->set(0.f, 1.0f, 0.f, 1.0f);
break;
case 2:
default:
color->set(0.f, 0.f, 1.0f, 1.0f);
}
gset->setAttr(PFGS_COLOR4, PFGS_OVERALL, color, NULL);
}
-- __________________________________________________________ | Dipl.-Ing. Günter Schreiber | phone: *49/*8153/28/1183 | | DLR - Deutsches Zentrum für | fax: *49/*8153/28/1134 | | Luft und Raumfahrt | | | Institut für Robotik und | email: | /| | Mechatronik | Guenter.Schreiber++at++dlr.de -------- | P.O. Box 1116 | / | | / | 82230 Wessling | ---+-+-- |________ http://www.robotic.de/Guenter.Schreiber _________| |/
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 00:23:08 PST