An Application-specific OpenGL Benchmark Harness

The best benchmark for a piece of graphics hardware is your own actual application, not some marketing benchmark number claimed by some hardware vendor hyping their own hardware.

To help you quickly determine your application's real rendering speed on a given piece of hardware, it often helps to isolate the important rendering code in your application into a small application-specific benchmark.

Below is source code for an OpenGL benchmarking harness that uses GLUT. The harness makes it very easy to construct small application-specific graphics benchmarks that test out the actual performance of rendering operations that your application really uses and depends on.

The harness is found in gl_harness.c. The harness contains GLUT code (including the main routine) for parsing command line arguments and actually timing the benchmark run. You simply write the actual rendering code and initialization code. You write a routine called testInit and another called testRender. Compile your test code with gl_harness.c and you've got a benchmark!

For an example of some benchmark code, see torus.c.

For more information about using the GLUT benchmark harness, see Section 6.6.8 titled "Constructing Application-specific Benchmarks" in the OpenGL performance section of my book Programming OpenGL for the X Window System (Addison-Wesley, ISBN 0-201-48359-9). The section's information applies even if you aren't programming for the X Window System so it is worth checking out.

- Mark Kilgard (