Skip to content
Luca Piccioni edited this page Apr 16, 2017 · 3 revisions

Getting started

Suppose you need a brand new extension exposed by the lastest OpenGL driver. How include it in OpenGL.Net? It is not that hard.

Follow the steps:

  1. Checkout the OpenGL XML Registry at https://github.com/KhronosGroup/OpenGL-Registry. Copy the files OpenGL-Registry/xml/gl.xml, OpenGL-Registry/xml/wgl.xml, OpenGL-Registry/xml/glx.xml and OpenGL-Registry/xml/egl.xml to the OpenGL.Net/GLSpecs/ directory.

  2. Open the a solution containing the BindingsGen (i.e. /All*.sln or /BindingsGen.sln). Build the BindingsGen project, using the Release configuration. Then run it: it takes some minute and lots of ram.

  3. Try to compile the OpenGL.Net projects: if no compilation errors occurs, you have almost done. In the case of compilation errors, you should check how to fix them by configuring (or modifying) the BindingsGen executable, or adapting the XML specifications.

  4. Check actual modifications on OpenGL.Net project. If they are correct and usable, commit them. Enjoy.

Configure the code generator

The BindingsGen code generator has configuration files that are embedded in the executable. They are XML files that adds metadata to OpenGL specification elements.

GLSpecs/CommandFlags.xml

This is the main configuration file. This file configure the following actions:

  • Add missing enumeration values
  • Rename methods and arguments
  • Configure method overload and behavior

GLSpecs/(Gl|Wgl|Glx|Egl|...)Words.xml

They are simple databases of names. The code generator will create overloads and name reductions using those words. Sometimes API updates introduce new words, and the relative database must be updated, otherwise wrapper method names will be scorched, possibly introducing compilation errors.

As example, you can read the commit fixing name scorching in GL_NV_draw_vulkan_image wrapper.

GLSpecs/CsTypeMap.xml

It is a simple database of key and value pairs for translating OpenGL specification types to C# types. It contains a lot of XML elements like:

<type name="GLushort" value="UInt16" />

Most likely you will not need to update this configuration, most of the types are already there, and rarely API updates introduce a new type.