Counting polygons in a LOD filled model

I would like to count how many polygons are displayed, within a generic model.
There are lots of these models, and they all have LOD’s.

The brute force approach is to count the number of polygons for each LOD, and figure out how many would be displayed for each given LOD combination.

Is there a way, with a pre and post draw callback, to count the number of polygons that we actually draw, per model, per frame?
IE.

predraw()
{
glStartCounter();
}
postdraw()
{
glStopCounter();
printf("The number of polygons in the model just drawn is %d
", glGetCount());
}

I know this probably doesn’t exist, but thought I’d ask.

Chris

Originally posted by TriangleMan:
[b]I would like to count how many polygons are displayed, within a generic model.
There are lots of these models, and they all have LOD’s.

The brute force approach is to count the number of polygons for each LOD, and figure out how many would be displayed for each given LOD combination.

Is there a way, with a pre and post draw callback, to count the number of polygons that we actually draw, per model, per frame?
IE.

predraw()
{
glStartCounter();
}
postdraw()
{
glStopCounter();
printf("The number of polygons in the model just drawn is %d
", glGetCount());
}

I know this probably doesn’t exist, but thought I’d ask.

Chris[/b]

Simply increment a counter when you draw the polygons.
For example:
glDrawElements(GL_TRIANGLES, num, GL_UNSIGNED_INT, ptr);
polygons+=num/3;

Unfortunately, this is all wrapped in Performer, so I don’t have easy access to stuff like that.
I was wanting to add something to a pre-draw callback to start a count, and a post-draw callback to stop the count, to see how many “elements” had been drawn since that time.
I didn’t think it existed, but it never hurts to ask.

Look into using pfStats for this.
http://www.cineca.it/manuali/Performer/ProgGuide24/html/Perf_PG-22.html

These things are counted in software and allow you to track what is actually drawn. Breaking it down might be tricky, without some kind of masking, but if you just want to know the count it would probbaly be possible to use channel masking to disable stuff you’re not interested in for a quick count then enable it again.

You should subscribe to the info-performer mailing list where people can answer questions related to that product:
http://www.sgi.com/software/performer/mailinglist.html