Back to main

GL Trace

GL Trace is a realtime debugger and analyzer for applications that use OpenGL. It can be used to examine the behaviour of applications that use OpenGL, view scene composition, inspect textures, inspect buffers, and view/modify shaders in realtime. It works by providing a wrapper dll that exports OpenGL calls based on the specification here, using automated code generation to produce a wrapper. All listed OpenGL and WGL functions are handled. Behaviour and parameters are analyzed for errors, and types that aren't immediately obvious from their arguments are resolved to their source, such as converting an input pair (GLuint*, int) to a list of N object IDs.

The main analysis works similar to NVIDIA's PerfHUD, allowing you to scroll back and forward in a sequence of draw calls in a scene. Scrolling forward allows the application to continue to the nth draw call, and scrolling backward allows the application's next frame to continue to the next frame's nth draw call. In an attempt to "freeze" the active frame, calls to QueryPerformanceCounter are hooked whenever an application is temporarily allowed to run, returning the smallest possible positive delta value for every call. The most obvious limitation of this method is that applications that don't rely on time, or rely on other high-resolution calls, such as RDTSC, cannot always be stepped through in reverse.

When a program's shader (vertex, fragment, etc) is modified, it is unlinked from its parent program, updated to hold the new source, and re-linked with the program. Any uniforms that were previously set are cached and set again after linking. Only GLSL shaders are supported. ARB programs are not currently recognized. Textures are converted to RGB8 for display in the texture inspector. Floating-point textures are linearly scaled into a [0-1] range, and cube maps are unrolled. GL Trace will try to guess what layout a certain buffer has, based on how it is used and what vertex attributes are set when it is bound.

Download v0.2

Change log

Changes in v0.2:
* Improved code generation now provides full compatibility with WGL.
* Textures with 1 to 4 channels can be dumped in integer or floating-point formats.
* Internal improvements to the method used by the UI to communicate with the dll and the application.
* Hooking into other libraries loaded by the application (such as GLUT) is now supported.
* The timing method used by GLUT is now recognized.
Note that applications which rely on unrecognized timing methods for frame timing cannot be frozen when
advancing backwards or advancing beyond the current frame.