Trial is heavily based on the OpenGL graphics API. GL can be rather difficult to deal with at times, and Trial includes a bunch of tools to ease handling its various complications.


Which GL features are even available depends a lot on the target system, and can only be known once the GL context has been executed. So, once the context is established, you can use gl-extension-p to test whether an extension is available, or directly run varying branches with when-gl-extension and gl-extension-case.

Branching based on available extensions allows you to implement optional features or fast paths for more recent OpenGL additions without dropping backwards compatibility.

The set of available extensions is also logged on context creation, though under the debug level.


OpenGL allows you to disable and enable various features at runtime. Trial tries to keep track of this feature set to ensure that, in the cases that knowing the set of features matters, the information can't drift.

To disable or enable features, you should use Trial's disable-feature and enable-feature functions, rather than directly calling GL's. You can then also use push-features, pop-features, or simply with-pushed-features to ensure that changes to the set of enabled features don't escape your local context.

For instance, to disable depth testing for a particular draw, you could wrap it in (with-pushed-features (disable-feature :depth-test) ...)

Vendor Specifics

You can fetch the name of the current graphics vendor with gl-vendor. It'll return either:

Sometimes it may be necessary to implement specific hardware vendor hacks to work around driver bugs.

Texture Formats

One of the most complicated areas of OpenGL is the texture formats and pixel data. Trial includes the following functions to allow you to deal with them a bit more easily. It also uses these functions internally to provide sane defaults for the texture and associated classes.