Moving forward with PyOpenGL XML Generation

So I finally (with some prompting) sat down to create a code-generator based on the Khronos specification xml documents (the things that khronos uses to generate the official OpenGL (GL and GLES), EGL, GLX, and WGL headers.  Originally I was trying to use Khronos own generator code, but in the end I just wound up my own registry-loader and generators.

One thing that came up is that the type definitions needed to be split out.  Khronos just gloms them into the header documents, but in Python you really want your types specified in a separate document (since they are hand-coded stuff that tries to make the types work nicely) that the main command/enum documents reference/use.  Previously that's been done in OpenGL/constants.py, but really we want different types for each of the APIs (e.g. you don't want to have to load EGL types when you're using WGL or vice-versa).  We're now going to use OpenGL/raw/API/_types.py to define the types, and each API will import (only) their own _types declarations.

The Khronos files should pretty much cover everything, all WGL extensions, all GLX, EGL, and GL/GLES extensions, as well as core of all of the APIs. The parsing/registry-loading code is also a lot simpler, though the handling of "remove" directives is currently to just ignore them.  There are still little bits in the registry spec that I don't handle, and I still need to get the WGL and GLX (and likely EGL) extension-procedure-loading bits written, but all in all, using the XML instead of parsing headers is looking very promising.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.