https://github.com/alexandrefournier/gl-spec-parser
An OpenGL specifications parser that outputs XML, D, etc.
https://github.com/alexandrefournier/gl-spec-parser
Last synced: about 1 year ago
JSON representation
An OpenGL specifications parser that outputs XML, D, etc.
- Host: GitHub
- URL: https://github.com/alexandrefournier/gl-spec-parser
- Owner: AlexandreFournier
- Created: 2011-03-12T14:47:15.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2014-03-03T21:47:25.000Z (over 12 years ago)
- Last Synced: 2023-03-23T04:04:22.433Z (over 3 years ago)
- Language: Python
- Homepage:
- Size: 4.25 MB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
=============================
OpenGL_ Specifications Parser
=============================
This project is a one file Python_ script that parses:
- `Khronos OpenGL 2.1 References Pages`_ (docbook)
- `Khronos OpenGL 3.3 References Pages`_ (docbook)
- `Khronos OpenGL 4.1 References Pages`_ (docbook)
- `Khronos OpenGL Extensions`_ (not-well-formated text format)
- `Khronos OpenGL Enumerants`_ (ugly-formated text format)
It's aim is mainly to build :
- Everything to generate bindings in one XML file
- More complicated D bindings for GL/GLU/GLX/GLEXT in one module
F.A.Q.
======
Why Khronos does not provide easy-to-parse specifications ?
-----------------------------------------------------------
.. role:: red
Khronos DOES finally provide easy-to-parse specifications as of 2013-06-13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XML specifications can be downloaded here: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml
This quote_ from the OpenGL_'s discussion board will be left here for historical purposes :
The specs contain much more information than what is (or *can* be) used in the C headers. Some of it is said to be used as part of the build process for various drivers. Other parts can be used to create strongly-typed enumerations (unfortunately, functions defined after OpenGL 1.4 use generic GLenum types instead of exact enums - in OpenTK, we've fixed this by hand for every single function up to 3.2). Finally, there's stuff like glx protocol information, display-list compatibility that is simply not exposed in the C headers.
The main issue is that the .spec files change over time. New directives are being added, old ones fall in disuse or start being used inconsistently... Fortunately, things have gotten better after the 3.0 release - several long-standing bugs have been fixed and the editors seem to have gotten much more aggressive. I think the new deprecation directives have played a large part in this.
FYI, there is no problem defining the "perfect spec format" to capture all .spec information (porting everything to XML is less than a day's worth of work). The issue is that drivers have come to rely on the .spec files to build and the IHVs (rightly or not) resist any change to their build process. (No, I'm not making this up - you can search these forums for the `exact quote`_ if you wish. It was made by Jon Leech around the 3.0 release, if I remember correctly.)
The irony on the matter is this quote on the registry, added around 2007 [edit: `11/17/2006 `__]: **"Yes, these databases should be moved to a modern XML-based format. Patience."** :P
Why XML instead of `SWIG`_ or any other IDL ?
---------------------------------------------
XML is easy to parse and most languages provide libxml_ bindings or XML parsers. This way it is very easy to generate bindings for other languages even for SWIG_.
License
=======
Boost Software License - Version 1.0 - August 17, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
.. _Python: http://www.python.org/
.. _OpenGL: http://www.opengl.org/
.. _SWIG: http://www.swig.org/
.. _libxml: http://xmlsoft.org/
.. _Khronos OpenGL 2.1 References Pages: http://www.opengl.org/sdk/docs/man/
.. _Khronos OpenGL 3.3 References Pages: http://www.opengl.org/sdk/docs/man3/
.. _Khronos OpenGL 4.1 References Pages: http://www.opengl.org/sdk/docs/man4/
.. _Khronos OpenGL Extensions: http://www.opengl.org/registry/#arbextspecs
.. _Khronos OpenGL Enumerants: http://www.opengl.org/registry/#specfiles
.. _quote: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=264041#Post264261
.. _exact quote: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=245032