Posted by: Morten Nobel-Jørgensen | March 10, 2013

Debugging OpenGL part 3 – using 3rd party debug tools


admin-ajaxThere exists a number of tools useful for performance profiling and debugging OpenGL. I’ll here give a short description of such program and how they are used.

An OpenGL program is a program linked with the OpenGL library, which is responsible for communicating with the graphics-card through the driver.

OpenGL program architecture

OpenGL program architecture

Using a debug tool a debug layer is inserted between the OpenGL and the OpenGL library. This new layer works as a proxy, which receives function calls from the OpenGL program and invokes the same functions on the actual OpenGL library (at least that how the tools conceptually work – actual implementations may differ).

OpenGL architecture using debugging tools

OpenGL architecture using debugging tools

Besides delegating function calls to the actual OpenGL library, the debug layer can also perform one or more of the following things:

  • Check for OpenGL errors after each function call invocation. This makes it easy to find OpenGL errors related to invalid parameters or invalid states.
  • Log the function name and its parameter. This often useful in larger OpenGL programs, where OpenGL calls are invoked from different parts of the program.
  • Capture geometry and textures send to the OpenGL. This makes it easy to see if the data is valid.
  • Measure performance and memory usage.
  • Track active OpenGL objects (buffers, textures, shaders)

The best thing about this debugging technique is that to start debugging no code changes are required. Simple launch the program using the debugging tool (or attach a running program) and you see the results instantly. Plug and play – even in cases where you don’t have access to the source code.

I recommend the following debugging tools:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: