libgliar   --   a library that lies to the OpenGL programs about the OpenGL context info (for Linux only)



Code:   bzr branch lp:libgliar

Libgliar is a library I wrote to make the OpenGL development easier at Canonical Ltd (who owns the copyright of the code) easier.

It's a library for OpenGL developers that work on Linux. It can be preloaded when a developer needs to "lie" to an OpenGL program in order to change the control flow.

For example:
An OpenGL program might have a different behavior depending on the extensions supported by the user's GPU, the shading language version, the OpenGL version, the vendor string or some other context related info, even when the maximum texture size or texture unit supported by the GPU varies.

Libgliar, fakes most of the OpenGL context information that can be returned by a glGet call. It reads a configuration file with the desired context info and returns that info instead of the actual glGet result.

gliar <opengl_program_name>



Using libgliar to fake the OpenGL output.




In the previous example:

We get the following glxinfo output when libgliar is preloaded:

$ gliar glxinfo | grep -i -A2 "OpenGL extensions" OpenGL extensions: GL_ARB_multisample, GL_EXT_abgr

The real glxinfo output would be:

$ glxinfo | grep -i -A2 "OpenGL extensions" OpenGL extensions: GL_ARB_multisample, GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color, GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_copy_texture,


The fake result can be obtained with a configuration file similar to this:

[extensions] GL_ARB_multisample GL_EXT_abgr



Note:   The users can only restrict their GPU capabilities in order to test their projects behavior in less capable machines. If a user adds a GL extension that is not supported by his system to the configuration file, he will receive a warning.