Overview of glean internals

Directory structure

Starting at $GLEAN_ROOT, you'll see bin, include, and lib directories. These are initially empty, and are filled by the Makefile in src.

$GLEAN_ROOT also contains documentation in doc, common Makefile templates in make, sample result files in results, and source code in src. The Makefile templates are particularly interesting, since they automate nearly all of the process of defining Makefiles.

cd into src, and take a look around. The main Makefile resides here. There are also subdirectories for glean itself (glean), a wrapper for OpenGL header files that covers up some Windows-specific problems (glh), libraries that are used by multiple tools (libs), and code for tools like showvis (tools). The Makefile ensures that everything in the subdirectories is built in the correct order.

Libraries

There are several libraries providing services that you may want when you start writing tests. These particular libraries are of sufficiently general usefulness that they're broken out into separate directories. (As we'll see later, some other services are local to the glean subdirectory.)

glean itself

glean consists of a relatively simple main program, a set of classes providing commonly-needed services, and the tests themselves.

The main program essentially just parses command-line options, creates the test environment (see below) and invokes each test in turn. The list of tests is generated automatically by test class constructors, so there's no need to maintain one independently. It should be fairly straightforward to replace the current main program with a graphical front-end, if anyone cares to do so.

The main service classes are as follows:

A few general utilities are also available:

To create a new test, you need do little more than create a new .cpp file in the glean subdirectory. (The Makefile will handle its dependencies and build it automatically.) All tests are derived from the base class Test. For truly new types of tests you'll need to derive a new class, but for many common types of tests you can start by copying a test that already exists. Here are some examples:

That's pretty much all there is to it. The glean framework provides most of the mechanisms needed to develop simple tests. Now it's time to create a good set of tests and thereby make a new tool that's valuable to the entire OpenGL community.