I was just wondering if there's an easy way to count the number
of vertices or polygons in an OpenGL scene for statistical/benchmark purposes ?
thanks a lot,
jan
If you draw your own objects, you already know the count of vertices and
polygons. if you don't know, you cannot draw them properly. Just init 2
variables before rendering and update them while rendering by adding the
vertex- & polygon-count for each object you draw.
Marc
> If you draw your own objects, you already know the count of vertices and
> polygons. if you don't know, you cannot draw them properly. Just init 2
> variables before rendering and update them while rendering by adding the
> vertex- & polygon-count for each object you draw.
>
> Marc
Welcome to the marvelous world of OOP ;-)
The drawing involves a lot of classes in the application in question,
and I don't want to stuff some dummy counter-code in all involved
objects.
There must be a more elegant way to achieve this ?!
At least OpenGL must know what it draws..
-jan
i hope not (in the sense that opengl would count every vertice etc u
pass to it, what a waste of time, quake3 would perhaps run slower for
what?, knowing how many vertices are drawn)
anyways
*perhaps override glVertex3f (and vertex arrays etc) for a new (+
improved ;)) glVertex3f that also upadtes a counter
*if u just want to see how many vertices are finally onscreen. perhaps
draw the scene in white, + then set polygon mode to POINTS and draw the
scene in black read back pixels counting the number of black ones,
(watch out for zfighting etc)
--
lets hear it for billy bollux and his bouncing balls
http://uk.geocities.com/sloppyturds/kea/kea.html
> J. Barnholt wrote:
>
> > "Marc Bo erhoff" wrote in message
> > news:...
> >
> >
> >> If you draw your own objects, you already know the count of vertices and
> >> polygons. if you don't know, you cannot draw them properly. Just init 2
> >> variables before rendering and update them while rendering by adding the
> >> vertex- & polygon-count for each object you draw.
> >>
> >> Marc
> >>
> >
> >
> > Welcome to the marvelous world of OOP ;-)
> >
> > The drawing involves a lot of classes in the application in question,
> > and I don't want to stuff some dummy counter-code in all involved
> > objects.
> >
> > There must be a more elegant way to achieve this ?!
> > At least OpenGL must know what it draws..
>
>
> i hope not (in the sense that opengl would count every vertice etc u
> pass to it, what a waste of time, quake3 would perhaps run slower for
> what?, knowing how many vertices are drawn)
>
> anyways
> *perhaps override glVertex3f (and vertex arrays etc) for a new (+
> improved ;)) glVertex3f that also upadtes a counter
> *if u just want to see how many vertices are finally onscreen. perhaps
> draw the scene in white, + then set polygon mode to POINTS and draw the
> scene in black read back pixels counting the number of black ones,
> (watch out for zfighting etc)
>
>
I have not the exact solution for you. Just some ideas... Add a virtual function
that will return a number of vertices for each object. Or add a static counter
into the base class and increment it in each object derived from it while
drawing (or use global variable).
-d
use glRenderMode(GL_FEEDBACK) and render your scene to a feedback
buffer. (Surely not accelerated, but might work for statistical
purposes)
regards
Ralph
(2) & (3) also work for third party applications.
Thanks,
Steven
"Dmitry Shulga" <sch...@erc.msstate.edu> wrote in message
news:3dd43...@nopics.sjc...