{"id":17331104,"url":"https://github.com/mosra/flextgl","last_synced_at":"2025-11-07T23:31:12.437Z","repository":{"id":54518264,"uuid":"1620626","full_name":"mosra/flextgl","owner":"mosra","description":"OpenGL and Vulkan header and loader generator.","archived":false,"fork":false,"pushed_at":"2024-10-04T11:46:59.000Z","size":884,"stargazers_count":206,"open_issues_count":3,"forks_count":14,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T04:13:08.088Z","etag":null,"topics":["game-engine","glfw","loader","magnum","opengl","opengl-es","python","sdl2","vulkan","webgl"],"latest_commit_sha":null,"homepage":"https://blog.magnum.graphics/hacking/simple-efficient-vulkan-loading-with-flextgl/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mosra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-04-15T20:04:54.000Z","updated_at":"2025-03-13T08:29:21.000Z","dependencies_parsed_at":"2024-11-07T17:00:20.854Z","dependency_job_id":"12b81bc7-3d22-48ea-94c7-c0bd86e51427","html_url":"https://github.com/mosra/flextgl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosra%2Fflextgl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosra%2Fflextgl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosra%2Fflextgl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosra%2Fflextgl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mosra","download_url":"https://codeload.github.com/mosra/flextgl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123102,"owners_count":20887261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-engine","glfw","loader","magnum","opengl","opengl-es","python","sdl2","vulkan","webgl"],"created_at":"2024-10-15T14:53:29.719Z","updated_at":"2025-11-07T23:31:12.409Z","avatar_url":"https://github.com/mosra.png","language":"C","readme":"flextGL\n=======\n\n[![Build Status](https://circleci.com/gh/mosra/flextgl.svg?style=shield)](https://circleci.com/gh/mosra/flextgl)\n[![Coverage Status](https://codecov.io/gh/mosra/flextgl/branch/master/graph/badge.svg)](https://codecov.io/gh/mosra/flextgl)\n\nflextGL is an OpenGL and Vulkan header and loader generator.\n\nIt is a bit different than other comparable systems:\n\n-   Gives complete control over exposed version and extensions\n-   Bindings directly generated from the OpenGL / Vulkan registry `gl.xml` /\n    `vk.xml` files\n-   For OpenGL, optionally exports only core-profile functions\n-   For Vulkan, it's possible to adapt the templates to generate separate\n    instance-specific and device-specific loader for faster runtime\n    performance, or switch from globally visible symbols to local ones\n    ([blog post with details](https://blog.magnum.graphics/hacking/simple-efficient-vulkan-loading-with-flextgl/))\n-   Only requested extensions are loaded\n-   Flexible python template system for source generation\n-   Source templates easy to adapt to project requirements\n-   (Optionally) specify only particular functions to be loaded\n\nYou will need the following dependencies:\n\n-   [Python 3.x](http://python.org)\n-   [Wheezy Template](http://packages.python.org/wheezy.template)\n\n### What's new?\n\n-   **October 2019:** Breaking change -- the GL `\u003cKHR/khrplatform.h\u003e` include\n    is now required to be specified by the template instead of being added\n    implicitly from the `gl.xml` definition. This is done in order to allow\n    more flexibility and is consistent with how `vk_platform.h` is handled.\n    See commit bef1e12c98562fa87b698751a75d9da84e11c98d for details.\n-   **May 2018:** Vulkan support, 100% test coverage,\n    [@mosra](https://github.com/mosra) took over the maintainership from\n    [@ginkgo](https://github.com/ginkgo)\n-   **January 30 2015:** Adding function whitelist and `lite` template\n-   **August 7 2014:** Adding support for generating OpenGL ES loading code\n-   **July 10 2014:** flextGL now parses `gl.xml` instead of the deprecated\n    `.spec` files.\n\nSource tree\n-----------\n\n-   `flextGLgen.py`\n\n    \u003e The generator script.\n\n-   `flext.py`\n\n    \u003e The parsing code\n\n-   `templates/`\n\n    \u003e The sub-directories in here contain the different template sets. You can\n    \u003e add your own template by simply creating a new folder in there.\n\n-   `profiles/`\n\n    \u003e Some example profile files to give you an idea on how to write your own.\n    \u003e `profiles/exampleProfile.txt` contains a lot of comments to get you up to\n    \u003e speed.\n\n-   `spec/` (generated)\n\n    \u003e This directory is automatically created by the script to store the\n    \u003e downloaded OpenGL and Vulkan XML spec files.\n\nUsage\n-----\n\nYou create your loader code by writing a profile file and passing it to the\nscript.\n\nHere is what a typical profile might look like:\n\n    version 3.3 core\n    extension EXT_texture_filter_anisotropic optional\n    extension ARB_tesselation_shader optional\n\nThis requests  an OpenGL core profile and  the extensions for anisotropic\nfiltering and tesselation shaders. Those extensions were requested as\n`optional`. This means that a missing extension won't cause an error. Instead,\nthe programmer will have to check before using it. This can be easily done by\ntesting a generated global variable. For OpenGL ES a typical profile might look\nlike:\n\n    version 3.0 es\n    extension OES_standard_derivatives optional\n    extension OES_vertex_array_object optional\n\nBecause the world is far from ideal, *certain vendors* don't bother upstreaming\ntheir extensions. To handle that, one can supply additional spec URLs to get\nmerged to the main one. Local files passed to `extraspec` also work, in case\nit's needed to manually add an entrypoint defined nowhere else. If the file\npath is relative, it's resolved relative to the profile file location.\n\n    version 2.0 es\n\n    extraspec https://raw.githubusercontent.com/google/angle/master/scripts/gl_angle_ext.xml\n\n    # This one is from the vanilla gl.xml\n    extension OES_vertex_array_object optional\n    # This one ... thanks for the unnecessary extra pain, Google\n    extension ANGLE_multi_draw optional\n\nA Vulkan profile, whitelisting only some particular functions, can look like:\n\n    version 1.1 vulkan\n\n    extension KHR_swapchain optional\n\n    begin functions\n        CreateInstance\n        CreateBuffer\n        CmdDraw\n        CreateSwapchainKHR\n    end functions\n\nIn case of Vulkan it's also possible to generate the output from a particular\nrelease by saying e.g. `version 1.1.73 vulkan`. That is useful in case you need\nto match exactly the release version required by\n[vulkan.hpp](https://github.com/KhronosGroup/Vulkan-Hpp), for example.\n\nThe profile file is then passed to the script like this:\n\n    $ python flextGLgen.py -D generated -t \u003ctemplate-of-your-choice\u003e profile.txt\n\nThis will create the requested source code and put it in the `generated/`\ndirectory.\n\nThe best way to work with flextGL is to integrate it in your build-system. The\nexample project demonstrates this for Make and CMake [here](https://github.com/ginkgo/flextGL-example).\n\nGenerated API for OpenGL\n------------------------\n\nThe builtin OpenGL templates all generate the following API:\n\n* `int flextInit()`\n  \u003e Initializes the OpenGL functions after context creation.\n\n* `FLEXT_MAJOR_VERSION`\n  \u003e The OpenGL major version defined in the profile file.\n\n* `FLEXT_MINOR_VERSION`\n  \u003e The OpenGL minor version defined in the profile file.\n\n* `FLEXT_CORE_PROFILE`\n  \u003e Boolean variable.  Is GL_TRUE,  if the profile  file defined  a core\n  \u003e profile.\n\n* `FLEXT_\u003cextension-name\u003e`\n  \u003e Generated global  variables for checking if a  specific extension is\n  \u003e supported.\n\nTake a look at the [example program](https://github.com/ginkgo/flextGL-example)\nto get an idea on how it's used.\n\nNote that it's possible to supply your own template with your own API that\nmight or might not resemble the above.\n\nGenerated API for Vulkan\n------------------------\n\nFor simplicity, the default template generates all function pointers globally\nand loads them as instance-specific. See\n[this blog post](https://blog.magnum.graphics/hacking/simple-efficient-vulkan-loading-with-flextgl/)\nfor other options. Apart from Vulkan APIs, two functions are defined:\n\n-   `void flextVkInit()`\n\n    \u003e   Initializes all global function pointers (pointers not depending on a\n    \u003e   particular VkInstance). Call this before doing anything else.\n\n-   `void flextVkInitInstance(VkInstance instance)`\n\n    \u003e   Initializes all instance-specific function pointers using given\n    \u003e   `instance` pointer. Call this once you have created a VkInstance.\n\nNote that it's possible to supply your own template with your own API that\nmight or might not resemble the above.\n\nTemplates\n---------\n\nAt the moment, there are three template sets available:\n\n-   `compatible`\n\n    \u003e This loads the extensions using a framework-agnostic method with WGL\n    \u003e AGL or GLX. This is probably a sensible default for most people.\n\n-   `glfw3`, `glfw3-es`\n\n    \u003e These use GLFW 3 functions for loading and testing for OpenGL extensions\n    \u003e either for desktop OpenGL or OpenGL ES. In these templates, the\n    \u003e `flextInit()` function takes a pointer to `GLFWwindow`.\n\n-   `lite`\n\n    \u003e A variant of the `compatible` template that generates more compact code.\n    \u003e It has not been thoroughly tested yet, though.\n\n*   `vulkan`\n\n    \u003e A basic loader for Vulkan.\n\n*   `vulkan-dynamic`\n\n    \u003e A variant of the `vulkan` template that loads the Vulkan library dynamically.\n    \u003e No static linking to Vulkan is necessary and the signature of `flextVkInit` is changed to `bool flextVkInit()`.\n    \u003e This lets you additionally check for the availability of Vulkan itself\n    \u003e and display an error message or fallback to another API if not available.\n\nInstalling Wheezy Template on Windows\n-------------------------------------\n\nIf you have Python 3.4+ installed you should be able to install Wheezy using pip.\n\n    $ pip install --user wheezy.template\n\nThe `--user` does a local install in your home-folder. You can omit it if you want\nto do a system-wide installation.\n\nIf you have an older version of Python or don't have pip for some reason, then\nyou need to [install](https://pip.pypa.io/en/latest/installing.html) it first.\n\nCredits\n-------\n\n-   Thomas Weber ([@ginkgo](https://github.com/ginkgo)) is the original author.\n-   The `compatible` template uses a few code snippets from Slavomir Kaslev's\n    gl3w OpenGL core profile loader for portable loading of procedures and\n    checking minor/major version in OpenGL \u003c 3.0.\n-   Mykhailo Parfeniuk ([@sopyer](https://github.com/sopyer)) provided most of\n    the `gl.xml` parsing code.\n-   Vladimír Vondruš ([@mosra](https://github.com/mosra)) added support for\n    OpenGL ES and Vulkan loader generation.\n-   Leander Beernaert ([@LeanderBB](https://github.com/LeanderBB)) did various\n    fixes on the compatible template.\n-   [@eternalrain](https://github.com/eternalrain) added support for function\n    white-lists and created the `lite` template.\n-   The Khronos Group Inc. ([https://www.khronos.org/vulkan/](https://www.khronos.org/vulkan/))\n    for Vulkan itself and the dynamic Vulkan library loader code.\n-   Tolga Mizrak ([@to-miz](https://github.com/to-miz)) added the dynamic\n    Vulkan loader template variant.\n\nLicense\n-------\n\nflextGL is licensed under the MIT/Expat license, see the [COPYING](COPYING)\nfile for details.\n","funding_links":[],"categories":["Bindings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosra%2Fflextgl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmosra%2Fflextgl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosra%2Fflextgl/lists"}