From: Brian Furtaw (brian++at++sgi.com)
Date: 10/19/2000 13:30:40
Kevin the pfdGeoBuilder could really help you out here read its man page
to get more details. Below I have attached some sample code to show you
how to use the geobuilder to make tristrips.
#include <Performer/pfdu.h>
#include <Performer/pf/pfGeode.h>
#include <Performer/pf/pfGroup.h>
#include <Performer/pr/pfGeoSet.h>
void build_tstrips(pfGroup *group) {
pfdGeoBuilder *bldr;
int nlist;
pfdGeom *pftri;
pfList *list;
pfGeode *geode = new pfGeode;
bldr = pfdNewGeoBldr();
// add one triangle at a time
pftri = pfdNewGeom(3);
pfdGeoBldrMode(bldr,PFDGBLDR_MESH_ENABLE, TRUE);
// insert your code here to fill out the triangle vertices
for(int j=0;j<500; j++){
pftri->flags = 0;
pftri->nbind = PFGS_OFF; // I have no normals to define
pftri->cbind = PFGS_OFF; // I have no colors to define
pftri->tbind = PFGS_OFF; // I have no texcoords to define
pftri->numVerts = 3;
pftri->primtype = PFGS_TRIS;
pftri->coords[0][PF_X]= 1.0f;
pftri->coords[0][PF_Y]= 0.0f;
pftri->coords[0][PF_Z]= 0.0f;
pftri->coords[1][PF_X]= 0.0f;
pftri->coords[1][PF_Y]= 1.0f;
pftri->coords[1][PF_Z]= 0.0f;
pftri->coords[2][PF_X]= -1.0f;
pftri->coords[2][PF_Y]= 0.0f;
pftri->coords[2][PF_Z]= 0.0f;
pfdAddGeom(bldr, pftri, 1);
}
//fprintf(stderr, "NTris = %d\n", pfdGetNumTris(bldr));
list = (pfList *) pfdBuildGSets( bldr );
nlist = list->getNum();
for(int i=0;i< nlist;i++) {
pfdPrintGSet((pfGeoSet *)list->get(i));
geode->addGSet((pfGeoSet *)list->get(i));
}
pfdDelGeoBldr(bldr);
group->addChild(geode);
}
You can have the geobuilder generate face normals, colors and texture
coordinates for you by setting the PFDGBLDR_AUTO_NORMALS,
PFDGBLDR_AUTO_COLORS and PFDGBLDR_AUTO_TEXTURE to
PFDGBLDR_NORMALS_GENERATE using the pfdGeoBldrMode function. Warning I
did not compile this code I just cut and pasted it together,
Brian
"K. Chugh" wrote:
>
> hi everyone- i have a set of points and verticex indices that i am using
> in an OpenGL app- i'm basically walking the list and drawing triangles.
> i want to convert that to a performer scene. 2 questions - 1) can i
> convert the triangles to a triangle strip easily- i read something about
> optimizer doing this. 2) how do i construct the scene graph- what kind
> of node is used for a triangle strip?
>
> thanks,
> kevin
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/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)
Graphics Guru Office:(301)572-3293 Fax: (603)250-0370
12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision
Silver Spring, Maryland 20904 Volumizer/Optimizer/React/PCI Device
Drivers
This archive was generated by hypermail 2b29 : Thu Oct 19 2000 - 13:40:03 PDT