There 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.
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).
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:
- glintercept (Windows)
After installing, simply add a .dll file and a configuration to your build output folder (typically debug only). No GUI, instead the result is written to log files. Very easy to install and use.
http://code.google.com/p/glintercept/ - AMD’s CodeXL (previously dDEBugger) (Windows / Linux)
Easy to use OpenGL debugging tool. You don’t need a AMD/ATI graphics card to use this tool
http://developer.amd.com/tools/heterogeneous-computing/codexl/ - OpenGL Profiler (OS/X)
Apple’s own OpenGL Profiler (note that this tool must be installed as part of the GraphicsTools).
http://developer.apple/com/downloads
https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGLProfilerUserGuide/GettedStarted/GettingStarted.html - WebGL Debug (WebGL)
For WebGL there there exist a simple proxy which checks for error after each webgl function call.
http://www.khronos.org/webgl/wiki/Debugging - More tools can be found here:
http://www.opengl.org/wiki/Debugging_Tools
Leave a Reply