Ong Eng Ban (eng40577++at++leonis.nus.sg)
Mon, 22 Sep 1997 15:17:45 +0800 (SST)
I have just started learning Performer and I tried to carry the following
task.
I have a set of polygons(triangles) generated from the Marching Cubes
algorithm and I tried to use perfly for rendering. There was no
compilation error but during the execution stage, the program terminated
by itself because of logical swap area error. I have doubled the swap area
but if I would to increase the number of triangles, the problem comes back
again. So could anyone advice me on how to overcome this problem?
The triangles are individual triangles and I'm using perfly in C,
Performer 2.0.
These are what I did:
I declared a geoNode, a geoSet and a geoState. I inserted
all the vertices into geoSet and then the geoState into
geoSet. Then I inserted the geoSet into geoNode and lastly
geoNode into DCS group. All these are done under the initSceneGraph() in
perfly.c
Below code illustrated what I have done.
>From initSceneGraph():
/* Create a DCS for TRACKBALL pfiXformer */
ViewState->sceneDCS = pfNewDCS();
ViewState->sceneGroup = pfNewGroup();
pfAddChild(scene, ViewState->sceneDCS);
pfAddChild(ViewState->sceneDCS, ViewState->sceneGroup);
/* ******************* Draw the medical image Gset ***********************
*/
Vcoords = (pfVec3 *)pfCalloc(Count_triangle * 3, sizeof(pfVec3),
arena);
Ncoords = (pfVec4 *)pfCalloc(Count_triangle * 3, sizeof(pfVec4),
arena);
for (i=0, j=0; i < Count_triangle; i++, j=j+3)
{
a0 = indices[i][0];
a1 = indices[i][1];
a2 = indices[i][2];
pfSetVec3(Vcoords[j], vertex[a0][0], vertex[a0][1],
vertex[a0][2]);
pfSetVec3(Vcoords[j + 1], vertex[a1][0], vertex[a1][1],
vertex[a1][2]);
pfSetVec3(Vcoords[j + 2], vertex[a2][0], vertex[a2][1],
vertex[a2][2]);
pfSetVec4(Ncoords[j], normal[a0][0], normal[a0][1], normal[a0][2],
1.0f);
pfSetVec4(Ncoords[j + 1], normal[a1][0], normal[a1][1],
normal[a1][2], 1.0f);
pfSetVec4(Ncoords[j + 2], normal[a2][0], normal[a2][1],
normal[a2][2], 1.0f);
}
mcgeode = pfNewGeode();
/* ********************** Set up a geoset ********************** */
gset = pfNewGSet(arena);
pfGSetAttr(gset, PFGS_COORD3, PFGS_PER_VERTEX, Vcoords, NULL);
pfGSetAttr(gset, PFGS_COLOR4, PFGS_PER_VERTEX, Ncoords, NULL);
pfGSetPrimType(gset, PFGS_TRIS);
pfGSetNumPrims(gset, Count_triangle);
/* *********Set up a geostate, backface removal turned off **********
*/
gstate = pfNewGState (arena);
pfGStateMode(gstate, PFSTATE_CULLFACE, PFCF_OFF);
pfGSetGState (gset, gstate);
pfAddGSet(mcgeode, gset);
pfAddChild(ViewState->sceneDCS, mcgeode);
/*
*************************************************************************
*/
/* Load each of the files named on the command line */
for (i = 0; i < NumFiles; i++)
{
Thanks.
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:58 PDT