https://github.com/cginternals/khrbinding-generator
A Python generator for the Khronos APIs OpenGL, OpenGL ES, OpenGL SC, and EGL
https://github.com/cginternals/khrbinding-generator
binding-generator egl opengl-api opengl-es opengl-sc
Last synced: 10 months ago
JSON representation
A Python generator for the Khronos APIs OpenGL, OpenGL ES, OpenGL SC, and EGL
- Host: GitHub
- URL: https://github.com/cginternals/khrbinding-generator
- Owner: cginternals
- License: mit
- Created: 2018-03-27T09:27:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-16T09:31:05.000Z (about 1 year ago)
- Last Synced: 2025-04-16T12:32:41.785Z (about 1 year ago)
- Topics: binding-generator, egl, opengl-api, opengl-es, opengl-sc
- Language: C++
- Size: 386 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# KHR Binding C++ Generator
## Process
1. Load XML from Khronos repository
2. Generate C++ API binding from XML
## Preconfigured Profiles
Currently available profiles for loading and generating (in subdirectory `profiles`):
* `gl.json` for the OpenGL API (results are deployed in [glbinding](https://github.com/cginternals/glbinding))
* `gles.json` for the OpenGL ES API (results are deployed in [glesbinding](https://github.com/cginternals/glesbinding))
* `glsc.json` for the OpenGL SC API (results are deployed in [glscbinding](https://github.com/cginternals/glscbinding))
* `egl.json` for the EGL API (results are deployed in [eglbinding](https://github.com/cginternals/eglbinding))
## Examples
### Load XML from Khronos repository
```bash
python3 update.py -p "profiles/gl.json"
python3 update.py -p "profiles/gles.json"
python3 update.py -p "profiles/glsc.json"
python3 update.py -p "profiles/egl.json"
python3 update.py -p "profiles/vk.json"
```
### Generate C++ API binding from XML
```bash
python3 generate.py -p "profiles/gl.json" -d "../glbinding/source"
python3 generate.py -p "profiles/gles.json" -d "../glesbinding/source"
python3 generate.py -p "profiles/glsc.json" -d "../glscbinding/source"
python3 generate.py -p "profiles/egl.json" -d "../eglbinding/source"
python3 generate.py -p "profiles/vk.json" -d "../vkbinding/source"
```
## Profile Documentation
A profile file is a JSON file with a flat layout, although semantic groups are intended.
The currently supported tags are:
* API specification
* `sourceUrl`: The url to download the API specification
* `sourceFile`: The intermediate file name to store the API specification
* `apiIdentifier`: For multi-API specification files, specifies the one API to select
* Code Generation
* `bindingNamespace`: The identifier for the subdirectories and C++ binding namespace
* `baseNamespace`: The C++ namespace for the generated API
* `coreProfileSince`: The version of core profile introduction (e.g., 3.2 for OpenGL)
* `multiContext`: Set to true if the API supports multiple contexts
* `booleanWidth`: The width of a boolean in this API (may be either 8 or 32)
More options are subject to future development. Ideas and requirements are welcomed.
### Example profile gl.json
```json
{
"": "API specification",
"apiIdentifier": "gl",
"sourceUrl": "https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/gl.xml",
"sourceFile": "gl.xml",
"": "Code Generation",
"bindingNamespace": "glbinding",
"baseNamespace": "gl",
"coreProfileSince": "3.2",
"multiContext": true,
"booleanWidth": 8
}
```
## Dependencies
* Python 3
* jinja2