From: faculaganymede (faculaganymede++at++yahoo.com)
Date: 01/23/2004 09:11:07
Greetings,
I have a question about counting the total number of
vertices in a pfGeoset.
According to Table 8-2 of the OpenGL Performer
Programming Guide, the following code should give me
the correct number of vertices in a geoset:
-------------------------------------------------
...
num_primitives = gset->getNumPrims();
num_vertices = 0;
switch( gset->getPrimType() )
{
case PFGS_POINTS :
num_vertices = num_primitives;
break;
case PFGS_LINES :
num_vertices = 2 * num_primitives;
break;
case PFGS_TRIS :
num_vertices = 3 * num_primitives;
break;
case PFGS_QUADS :
num_vertices = 4 * num_primitives;
break;
case PFGS_TRISTRIPS :
case PFGS_TRIFANS :
case PFGS_POLYS :
case PFGS_LINESTRIPS :
case PFGS_FLAT_LINESTRIPS :
case PFGS_FLAT_TRISTRIPS :
case PFGS_FLAT_TRIFANS :
lens = gset->getPrimLengths();
for( i = 0; i < num_primitives; i++ )
num_vertices += lens[i];
break;
}
return num_vertices;
...
-------------------------------------------------
But, for flat-shaded primitives, this doesn't seem to
return the correct number of vertices. It appears I
need to do an offsets as followed (based on what I
observed in other people's code):
int flat_shaded_offset=0;
if (primitive_type == PFGS_FLAT_LINESTRIPS)
flat_shaded_offset=num_primitives;
else if (primitive_type == PFGS_FLAT_TRISTRIPS ||
primitive_type == PFGS_FLAT_TRIFANS)
flat_shaded_offset=2*num_primitives;
num_vertices = num_vertices - flat_shaded_offset;
QUESTION 1:
************
Why is it necessary to offset the vertices count for
flat-shaded primitives? Is this GENERALLY true?
QUESTION 2:
************
How is a linestrip different from a flat-linestrips,
tripstrip from a flat tripstrip, trifans from a flat
trifans? I couldn't find any drawings in the
documents for flat-shaded primitives.
=====
Thanks,
faculaganymede
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
This archive was generated by hypermail 2b29 : Fri Jan 23 2004 - 09:15:48 PST