Francois Sillion (Francois.Sillion++at++imag.fr)
Mon, 10 Feb 1997 09:22:16 +0100 (MET)
The following message is a copy of my recent post in comp.sys.sgi.graphics,
which I posted before I had heard about this list. Sorry for
the inconvenience if you have already seen this.
I am relatively new to Performer, but I think I have tried
hard to read all the manuals and understand how it works.
But I am still stumbling on a (probably stupid) problem with
the definition of my pfGeosets.
In my application I have a number of polygons coming in random order
and composed of varying numbers of vertices. I am creating a pfGeoset
and calling settAttr to define the vertices. Since I have polygons of different
lengths I thought I should use the PFGS_POLYS primitive type.
The problem I have is that extraneous polygons are drawn with wrong
vertices. I tried to pfPrint the scene, and I don't understand the listing:
the primitive type (POLYS), number (2) is correct, so is the
number of vertices (8) [at least I have 8 indices in the list], but
17 "Coord Index " lines are shown.
All arrays have been pfMalloc()ed, and are correct as shown in the cvd debugger.
The "extra" indices do correspond to the memory contents after the end of
the pfFaceIndices array. But the pfGroupFaceLengths used to specify the number
of vertices per poly is also correct.
When I switch the primitive type to QUADS, on a small example
that has only two quads, it works OK. On that same small example, the
following code produces the scene shown below (obtained with pfPrint):
pfGeoSet * g = new pfGeoSet;
// Fill in geometry data
g->setNumPrims(2);
g->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, pfVerts, pfFaceIndices);
g->setPrimLengths(pfGroupFaceLengths);
g->setDrawMode(PFGS_WIREFRAME, PF_ON);
g->setPrimType(PFGS_POLYS);
g->setGState( MaterialGeoState[i] );
----------------------- clipped from scene.out ---------------------------
[0:0]pfScene pfId=466 0x18a90d90 {
trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
bsphere: ctr(4963.221680, 1710.173828, 95.034027) rad=368.719330
Num Children: 1
[1:0]pfGroup pfId=467 0x18acd780 {
trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
bsphere: ctr(4963.221680, 1710.173828, 95.034027) rad=368.719330
Num Children: 2
[2:0]pfGroup pfId=468 0x18a9f710 {
trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
bsphere: ctr(4877.314941, 2058.479980, 111.949997) rad=9.576769
Num Children: 1
[3:0]pfGeode pfId=469 0x18ab40d0 {
trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
bsphere: ctr(4877.314941, 2058.479980, 111.949997) rad=9.576769
Num pfGeoSets: 1
[4:0]
GeoSet: 0x18a90e20 {
Primitive: PFGS_POLYS, INDEXED, pfPrims=2, glPrims=4,
verts=8
Attribute Bindings:
PFGS_COLOR4=PFGS_OFF PFGS_NORMAL3=PFGS_OFF
PFGS_TEXCOORD2=PFGS_OFF
Attribute List Pointers:
PFGS_COORD3: 0x18b9d450
PFGS_COLOR4: 0x0
PFGS_NORMAL3: 0x0
PFGS_TEXCOORD2: 0x0
Attribute Index List Pointers:
PFGS_COLOR4: 0x0
PFGS_NORMAL3: 0x0
PFGS_TEXCOORD2: 0x0
PFGS_COORD3: 0x18acd810
Strip Lengths: 4 4
Coord Index: 1 X: 4872.009766 Y: 2060.750000
Z: 112.570000
Coord Index: 2 X: 4882.160156 Y: 2055.530029
Z: 112.570000
Coord Index: 3 X: 4884.509766 Y: 2059.600098
Z: 111.330002
Coord Index: 4 X: 4874.609863 Y: 2064.770020
Z: 111.330002
Coord Index: 2 X: 4882.160156 Y: 2055.530029
Z: 112.570000
Coord Index: 1 X: 4872.009766 Y: 2060.750000
Z: 112.570000
Coord Index: 5 X: 4870.120117 Y: 2057.270020
Z: 111.339996
Coord Index: 6 X: 4880.669922 Y: 2052.189941
Z: 111.339996
Coord Index: 6316 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 55408 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 6316 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 55280 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 6312 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 42928 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 6313 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 3760 X: 0.000000 Y: 0.000000 Z:
0.000000
Coord Index: 0 X: 0.000000 Y: 0.000000 Z:
0.000000
} GeoSet: 0x18a90e20
[4:0]
[3:0]} pfGeode 469 0x18ab40d0
[2:0]} pfGroup 468 0x18a9f710
.. other pfGroups deleted...
I am sure I am missing something simple, but what ? How come the pfPrinted
data shows so many extra indices, when the primLengths and numPrims have been
properly defined ?
Thanks in advance for your help !
+------------------+------------------------------------------------------+
| Francois SILLION | iMAGIS - GRAVIR/IMAG, B.P. 53, 38041 Grenoble Cedex 9|
| ' | France. Tel:+33 4 76 51 43 54 - Fax:+33 4 76 44 66 75|
+------------------+----------+-------------------------------------------+
| Francois.Sillion++at++imag.fr | http://w3imagis.imag.fr/~Francois.Sillion |
+-----------------------------+-------------------------------------------+
=======================================================================
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:54:37 PDT