{"id":13731722,"url":"https://github.com/MetricPanda/glgen","last_synced_at":"2025-05-08T05:30:33.615Z","repository":{"id":216134744,"uuid":"50849590","full_name":"MetricPanda/glgen","owner":"MetricPanda","description":"Minimal OpenGL extension loader","archived":true,"fork":false,"pushed_at":"2016-10-18T07:07:40.000Z","size":15,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-14T22:35:40.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetricPanda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-02-01T15:43:17.000Z","updated_at":"2023-01-28T20:43:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5b4ceef-197c-44f4-b764-3a7d48f04a24","html_url":"https://github.com/MetricPanda/glgen","commit_stats":null,"previous_names":["metricpanda/glgen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetricPanda%2Fglgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetricPanda%2Fglgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetricPanda%2Fglgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetricPanda%2Fglgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetricPanda","download_url":"https://codeload.github.com/MetricPanda/glgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253008351,"owners_count":21839635,"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":[],"created_at":"2024-08-03T02:01:36.976Z","updated_at":"2025-05-08T05:30:33.605Z","avatar_url":"https://github.com/MetricPanda.png","language":"C++","readme":"# glgen \n\n*glgen* is a minimal OpenGL extension loader that parses your project files and generates a header file based on the functions you actually use.\n\nThe definitions are extracted from header files provided by the [Khronos OpenGL API registry](https://www.opengl.org/registry/).\n\nThe boilerplate code that initializes OpenGL and loads all function pointers is minimal and cross platform.\n\n## Usage\n\nglgen requires an API registry header file that you can download from the [Khronos OpenGL API registry](https://www.opengl.org/registry/).\nYou must also specify the output file with the `-o` option, and one or more `\u003cinputfile\u003e` to parse.\n\n```\nUsage: glgen [-h] -gl \u003cregistryfile\u003e -o \u003coutputfile\u003e \u003cinputfiles...\u003e\n\nrequired arguments:\n  -gl \u003cfilename\u003e       OpenGL header file downloaded from https://www.opengl.org/registry/\n  \u003cinputfiles...\u003e      One or more input C/C++ files\n  -o \u003cfilename\u003e        Generated file containing typedefs and boilerplate code\n\noptional arguments:\n  -h                   Prints this help and exits\n  -p \u003cprefix\u003e          Function prefix for boilerplate code.\n  -i \u003ctoken1,token2\u003e   Ignored tokens (comma separated).\n  -no-b                Don't generate the OpenGL loading boilerplate code\n```\n\nThe generated boilerplate code that initializes OpenGL can be used like so:\n\n\n``` cpp\nOpenGLVersion Version;\nOpenGLInit(\u0026Version);\nif(Version.Major \u003c 3)\n{\n  printf(\"OpenGL 3 or above required.\\n\");\n  return 0;\n}\n```\n\nThis is the definition of the `OpenGLVersion` struct:\n``` cpp\nstruct OpenGLVersion\n{\n  int Major;\n  int Minor;\n};\n```\n\nTo avoid collisions with your code you can specify a prefix with the `-p` option like so:\n\n```\nglgen source1.h source1.cpp source2.cpp -gl glcorearb.h \\\n  -o opengl.generated.h -p PREFIX_\\\n  -i glfwGetFramebufferSize,glfwMakeContextCurrent,glfwSwapInterval\n```\n\nAnd the following code will be generated:\n\n``` cpp\nstruct PREFIX_OpenGLVersion\n{\n  int Major;\n  int Minor;\n};\n\nstatic void PREFIX_OpenGLInit(PREFIX_OpenGLVersion* Version);\n```\n\n## Running as part of your build\n\nYou can run glgen just before your normal build to keep the generated header up to data. For example, you can add the following to your `CMakeLists.txt` and glgen will be integrated in your build:\n\n``` CMake\n\nset(PREPROCESS_OPENGL_SOURCES ${CMAKE_SOURCE_DIR}/src/file1.cpp ${CMAKE_SOURCE_DIR}/src/file1.h)\nset(PREPROCESS_OPENGL_OUTPUT ${CMAKE_SOURCE_DIR}/src/opengl.generated.h)\nadd_custom_target(\n  OpenGLPreprocess\n  COMMENT \"Preprocessing OpenGL\"\n  COMMAND glgen ${PREPROCESS_OPENGL_SOURCES} -gl ${CMAKE_SOURCE_DIR}/src/lib/glcorearb.h -o ${PREPROCESS_OPENGL_OUTPUT} -p PREFIX_ -i glfwGetFramebufferSize,glfwMakeContextCurrent,glfwSwapInterval\n)\nadd_dependencies(${EXECUTABLE} OpenGLPreprocess)\n\n```\n\n## License\n\nglgen is in the public domain. See the file [LICENSE](LICENSE) for more information.\n\n## Copyright\n\n[OpenGL](http://www.opengl.org/) is a registered trademark of [SGI](http://www.sgi.com/).\n\n","funding_links":[],"categories":["Graphics"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetricPanda%2Fglgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMetricPanda%2Fglgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetricPanda%2Fglgen/lists"}