PDA

View Full Version : Counting polygons in a LOD filled model



TriangleMan
07-22-2003, 07:02 AM
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\n", glGetCount());
}

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

Chris

Csiki
07-26-2003, 03:18 AM
Originally posted by TriangleMan:
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\n", glGetCount());
}

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

Chris

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

TriangleMan
07-26-2003, 07:42 AM
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.

dorbie
07-26-2003, 03:19 PM
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