Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Adept I

how to get the quantity of drawn triangles or points in OpenGL?

In OpenGL,is there a build-in function that can get the quantity of drawn triangles or points?

5 Replies
Adept I


No, there is no functionality built in OpenGL that handles this. That would be a higher level abstraction than what the API was designed to do. D3D doesn't do this either.

One solution is to simply add up all of the 'count' values from the draw commands per frame.

But this doesn't account for clipping/culling so I suggest using a debugging/profiling tool such as AMD's own PerfStudio2 or Intel's Graphics Performance Toolkit or similar.

I clipped my model by setting clip planes. And i want to know the quantity of points or triangles that were drew before and after clipped. Then I can compare them to know the efficiency.

Can AMD's own PerfStudio2 or Intel's Graphics Performance Toolkit or similar  figure this out?


With PerfStudio2, in the Frame Profile, you can use the Per-Draw Data counters. Under PrimitiveAssembly, you have PrimitivesIn, CulledPrims and ClippedPrims. If you profile with those counters selected, you'll get the data you are looking for. ClippedPrims also takes in consideration custom clipping planes.

I have tried the PerfStudio2. After I connected it to my application,the Frame Debugger button and the Frame Profiler button is grey and can't be use. So I guess I should try Intel's Graphics Performance Toolkit.


    That's odd. If you connect to the server app with the client, and pause the server (the pause button in PerfStudio 2), the profiling buttons should become available after frame capturing completes. Be aware, this does take a few seconds.The pause button becomes available, when the connection button turns red.

    I haven't had any issues with PerStudio 2 (except it crashing when using glMultiDraw....). I'm exclusively using it on my main development rig (R9 290).

P.S. If you have an NVidia machine available, you should also look at nSight that offers similar functionality.