{"id":13712761,"url":"https://github.com/ikskuh/zig-opengl","last_synced_at":"2025-04-12T03:24:19.653Z","repository":{"id":45306110,"uuid":"317056487","full_name":"ikskuh/zig-opengl","owner":"ikskuh","description":"OpenGL binding generator based on the opengl registry","archived":false,"fork":false,"pushed_at":"2024-10-25T17:45:25.000Z","size":824,"stargazers_count":107,"open_issues_count":3,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T13:25:41.065Z","etag":null,"topics":["gamedev","opengl","opengl-es","opengl-loader","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikskuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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},"funding":{"github":"MasterQ32"}},"created_at":"2020-11-29T22:35:28.000Z","updated_at":"2025-03-24T07:07:05.000Z","dependencies_parsed_at":"2023-10-01T20:22:02.436Z","dependency_job_id":null,"html_url":"https://github.com/ikskuh/zig-opengl","commit_stats":null,"previous_names":["ikskuh/zig-opengl","masterq32/zig-opengl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzig-opengl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzig-opengl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzig-opengl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzig-opengl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikskuh","download_url":"https://codeload.github.com/ikskuh/zig-opengl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511030,"owners_count":21116336,"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":["gamedev","opengl","opengl-es","opengl-loader","zig","zig-package","ziglang"],"created_at":"2024-08-02T23:01:22.343Z","updated_at":"2025-04-12T03:24:19.631Z","avatar_url":"https://github.com/ikskuh.png","language":"C#","funding_links":["https://github.com/sponsors/MasterQ32"],"categories":["Graphics Library"],"sub_categories":["Zigged Project"],"readme":"# Zig OpenGL Binding\n\nThis is a pragmatic binding to different OpenGL versions.\n\nIt uses the official [OpenGL Registry](https://github.com/KhronosGroup/OpenGL-Registry) by Khronos to generate the Zig code.\n\nRight now, it does minimal adjustments like removing the `gl` prefix from functions or the `GL_` prefix from constants. Everything else is the same as the C API.\n\nThere is a single non-OpenGL function exported:\n\n```zig\npub fn load(load_ctx: anytype, get_proc_address: fn(@TypeOf(load_ctx), [:0]const u8) ?*FunctionPointer) !void {\n```\n\nThis function will load all OpenGL entry points with the help of `get_proc_address`. It receives the `load_ctx` as well as the function name.\n\n**NOTE:** Please do not reference `zig-opengl` as a submodule or a package. Generate a binding and copy the output of that into your repository and update the file on demand. The OpenGL Registry is just too huge to be used conveniently.\n\nCloning submodules is required, so use `--recursive`:\n\n```bash\ngit clone --recursive https://github.com/ikskuh/zig-opengl.git\n```\n\n## Example\n\nThis example uses [ZWL](https://github.com/Aransentin/ZWL/) by @Aransentin.\n\n```zig\nconst zwl = @import(\"zwl\");\n\nconst Platform = zwl.Platform(…);\n\npub fn initAndDraw(window: Platform.Window) !void {\n  try gl.load(window.platform, Platform.getOpenGlProcAddress);\n\n  while(true) {\n    gl.clearColor(1, 0, 1, 1);\n    gl.clear(gl.COLOR_BUFFER_BIT);\n\n    try window.present();\n  }\n}\n```\n\n### Usage with mach-glfw\n\nThere is an example of `mach-glfw` + `zig-opengl` usage available here: https://github.com/hexops/mach-glfw-opengl-example\n\n## Pregenerated Loaders\n\nThis repository contains pre-generated bindings for all extension-free OpenGL versions.\n\n## Generating your own loader\n\n### From source\n\nTo generate your own loader, you have to clone this repository and build the generator with `dotnet`:\n\n```sh-session\nuser@machine:~/zig-opengl$ dotnet run\nUsage: generator \u003cregistry\u003e \u003cresult\u003e \u003capi_version\u003e [\u003cextension\u003e] [\u003cextension\u003e] ...\nuser@machine:~/zig-opengl$ dotnet run OpenGL-Registry/xml/gl.xml gl3v3.zig GL_VERSION_3_3\nFinal API has 344 commands and 818 enums types.\nuser@machine:~/zig-opengl$\n```\n\n```sh-session\ndotnet run \\\n  OpenGL-Registry/xml/gl.xml \\ # path to the opengl registry\n  my_binding.zig             \\ # path to the generated file\n  GL_VERSION_3_3             \\ # feature level, options listed below\n  …                            # Add your extensions here, each as a single arg. Or let them out, you don't need extensions\n```\n\nPossible feature levels (at the time of writing) are:\n\n- `GL_VERSION_1_0`\n- `GL_VERSION_1_1`\n- `GL_VERSION_1_2`\n- `GL_VERSION_1_3`\n- `GL_VERSION_1_4`\n- `GL_VERSION_1_5`\n- `GL_VERSION_2_0`\n- `GL_VERSION_2_1`\n- `GL_VERSION_3_0`\n- `GL_VERSION_3_1`\n- `GL_VERSION_3_2`\n- `GL_VERSION_3_3`\n- `GL_VERSION_4_0`\n- `GL_VERSION_4_1`\n- `GL_VERSION_4_2`\n- `GL_VERSION_4_3`\n- `GL_VERSION_4_4`\n- `GL_VERSION_4_5`\n- `GL_VERSION_4_6`\n- `GL_VERSION_ES_CM_1_0`\n- `GL_ES_VERSION_2_0`\n- `GL_ES_VERSION_3_0`\n- `GL_ES_VERSION_3_1`\n- `GL_ES_VERSION_3_2`\n- `GL_SC_VERSION_2_0`\n\n## Contribution\n\nThis library uses a small C# script that generates the Zig bindings. It is located in `src/Generator.cs`\n\n## What is missing right now?\n\n- Option to specify `core` or `compatibility` profile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2Fzig-opengl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikskuh%2Fzig-opengl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2Fzig-opengl/lists"}