Re: Dynamic change of number of vertexes

New Message Reply Date view Thread view Subject view Author view

From: Brian Furtaw (brian++at++sgi.com)
Date: 02/20/2002 06:26:18


Guenter,

You need to create a fluxed pfGeoSet to do this, a great example of how
to do this came with the Performer sample src ccheck out,
/usr/share/Performer/src/pguide/libpf/C++/fluxed_gset.C

Brian

Guenter Schreiber wrote:
>
> 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 _________| |/
> -----------------------------------------------------------------------
> 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
> -----------------------------------------------------------------------

-- 
    ----oOOo----    ----oOOo----    ----oOOo----    ----oOOo----

Brian Furtaw (brian++at++sgi.com) Mailstop: DSE-2612 Graphics Guru Office:(301)572-3293 Fax: (253)323-8182 12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision Silver Spring, Maryland 20904 Volumizer/Optimizer/React/PCI Device Drivers


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 06:36:20 PST

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