Clone wiki

glLoadGen / Command_Line_Options

The command-line options for the code generation tools are explained here. They work more or less like the standard command-line options for typical Linux/Windows programs. Options that have a single value can take their parameters as either -opt_name=parameter or -opt_name parameter.

With Lua on the path, the command-line should be specified as follows:

lua pathToLoadgen/LoadGen.lua <output filename> <options>

The <output filename> must be specified. The path provided is relative to the current directory. The base filename of the path (everything after the last directory separator) will be decorated as appropriate for generating the output files. You should not provide an extension; the system will provide those as needed. The generated files will append an appropriate prefix, depending on which specifications you are generating (OpenGL, WGL, or GLX), so you can provide the same base filename for all of these.

The output filename should be specified before any of the options. You can specify it after the options or even between options, but if you specify it after the -exts option (but before any subsequent options), the system will mistake it for an extension name. Just specify it first to be safe.


Defines the particular specification to generate loading code for. It must be one of the following values:

  • gl: default
  • glX
  • wgl


The code generation system will try to minimize the number of non-static global variables it defines as much as possible. However, it will have to use some non-static variables for various things.

Code generated from the different specifications are guaranteed not to have name collisions. However, if you generate code from the same specification, with different sets of extensions or versions, collisions will occur.

The prefix option allows you to define a string that will be prepended to any non-static (or otherwise hidden) global variables, where possible. As such, the prefix should start with characters that are valid for C/C++ identifiers. The prefix will be used as the style decides, so a prefix could just as well be a namespace as an actual name prefix.

If the option is not specified, no prefix will be used.


The highest version of OpenGL to export. You may only use this when -spec is gl. And you must use it when the specification is gl. You can specify a valid OpenGL version number, or your can specify "max". This means to use the highest available OpenGL version.


The OpenGL profile to export. It must be one of the following values:

  • core: default
  • compatibility: It is an error to specify this for OpenGL versions that do not have the core/compatibility distinction.


The code generation suite has a number of different ways of outputting the functions and enumerators that define OpenGL. This option allows the user to select between these particular mechanisms.

The specific meaning of these parameters is explained elsewhere. Note that the system is designed to be user-extensible; new styles can be added by creating an appropriate script and hooking it into the right place in modules/Styles.lua.

It must be one of the following values:

  • pointer_c: Used for C-style header generation.
  • pointer_cpp: Used for creating C++-style loaders, wrapping as much as possible in namespaces.
  • noload_cpp: Used for creating C++-style loaders that you don't need to call an initialization function on to get function pointers.
  • glload: For internal use only.


The indentation style for the output text. It must be one of the following:

  • tab: default
  • space: Will use 2 spaces to indent.


Defines a list of extensions to the given specification to export. Every argument that doesn't start with a "-" following this option will be assumed to be an extension name. You do not need to prefix the extensions with GL_, WGL_, or GLX_, but you may do so if you wish.

This argument can be specified multiple times. It is fine to specify an extension name more than once.


Defines a single extension to export. It adds the given parameter to the list of extensions.

This argument can be specified multiple times. It is fine to specify an extension name more than once.


Specifying dozens of extensions on the command line can be exceedingly tedious. Therefore, the system can be instructed to read a list of extensions from a file with this option. The format is fairly simple, but it does have an inclusion mechanism to include other extension files.

This argument can be specified multiple times. It is fine to specify an extension name more than once, either in the file or on the command line.

The file's directory is relative to the path where the command line was invoked.


Works like extfile, except that the directory for the file is relative to the extfiles directory, just under the directory where the LoadGen.lua file is. These are used primarily for working with the library of common extension files.