BuGLe—OpenGL Debugging Wrapper

BuGLe is a tool for OpenGL debugging, implemented as a wrapper library that sits between your program and OpenGL. Although it's still in development, the Web site states that it already can do the following:

  • Dump a textual log of all GL calls made.
  • Take a screenshot or capture a video.
  • Call glGetError after each call to check for errors, and wrap glGetError so that this checking is transparent to your program.
  • Capture and display statistics (such as framerate).
  • Force a wireframe mode.
  • Recover a backtrace from segmentation faults inside the driver, even if the driver is compiled without symbols.

In addition, there is a debugger (gldb-gui) that lets you set breakpoints and examine backtraces. It also lets you examine OpenGL state, shaders, textures, buffers and so on, and drop into gdb to see what is going wrong.

BuGLe is a powerful wrapping tool that can perform certain actions with a program when specified OpenGL functions are called.

A debugger also can be used while a program is running alongside.

Installation

BuGLe is available only as source for the moment, so head to the Web site and grab the latest tarball. As for requirements, the Web site says you'll need the following:

  • GCC 3.2 or later (4.0 is broken, but 4.1 works).
  • FFmpeg is needed for video capture.
  • GNU readline is recommended for history editing in gldb.
  • GTK+ is required for gldb-gui.
  • GtkGLExt and GLEW are highly recommended for gldb-gui (without them, the texture display will not work).

I found I also had to grab libgtkglext1-dev as well as libreadline5-dev to access some of the features that are pretty mandatory. I couldn't get my system to recognize libavcodec, which may have caused me some problems later on.

As for compilation, the documentation says you just have to run make to begin with, but I found I had to run the configure script first, or else make would return an error. If I'm right, then you'll need to run these commands:

$ ./configure
$ make

If your distro uses sudo:

$ sudo make install

If your distro doesn't use sudo:

$ su
# make install

I'll quote the documentation directly for the next part:

Next, you need to install some files for the user that will run bugle. Create a directory $HOME/.bugle, and copy doc/examples/filters and doc/examples/statistics into it.

Usage

Okay, I have to level with you, I didn't get BuGLe to run the way I wanted it to (such as taking screenshots, video and so on). Maybe it was the configure script, maybe it was libavcodec not detecting, or perhaps I'm just dumb and missed something in the interface. I don't know. So why am I still highlighting this program? I see some great potential here, and what may be something very powerful in the future for anyone in the IT industry.

All I can really do is point you in BuGLe's direction and hope you have more luck than I did. I did get some functionality working, including some debugging, so I'll show you at least some basics that a puny mortal like myself managed to grasp.

To run BuGLe at the command line, use the following syntax:

$ LD_PRELOAD=libbugle.so your-program [plus any arguments]

To use the GUI version (much easier), use this syntax:

$ gldb-gui your-program [plus any arguments]

This last command starts BuGLe's GUI, but your program won't be running yet. Prior to running something, you can apply certain parameters, such as setting breakpoints on specified OpenGL functions. For information on this, check the Web site's documentation (although it seems to be geared more for other developers than users at this time of writing).

To actually run your program, it's as easy as clicking Run→Run. You can stop a program manually by clicking Run→Stop. The program can be continued with Run→Continue, or continued until the next OpenGL function call with Run→Step, and killed with Run→Kill. Also worth a look is the debugging console, under Run→Attach GDB, which has its own unique set of functions and commands.

And although I couldn't work out how to get these running myself, in the on-line documentation, I found the following instructions for using screenshot/video capture filter sets.

For straight screenshots:

filterset screenshot
{
    filename "screenshot.ppm"
    key_screenshot "C-A-S-S"
}

For captured video:

filterset screenshot C-V inactive
{
    video "yes"
    filename "video.avi"
    codec "mpeg4"
    bitrate "1000000"
    allframes "no"
}

I may not have had much luck with BuGLe's bigger functions, but this is software in its early stages. When this project matures, the coding and its resulting possibilities will no doubt be very powerful—whether you're a graphics developer testing the latest driver or just a journo like me looking to take a screenshot from within a program. And when that happens, someone probably will come along with a second GUI to use its functions in an alternative way, such as home users taking videos of whatever program they're running. Either way, the potential uses for this project are huge.

BuGLe—OpenGL Debugging Wrapper: www.opengl.org/sdk/tools/BuGLe

Load Disqus comments