{"id":20270946,"url":"https://github.com/mackron/glbind","last_synced_at":"2025-04-11T04:21:52.191Z","repository":{"id":60105706,"uuid":"175593509","full_name":"mackron/glbind","owner":"mackron","description":"Single file OpenGL API loader.","archived":false,"fork":false,"pushed_at":"2024-02-10T05:00:03.000Z","size":1294,"stargazers_count":59,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-01T21:21:00.455Z","etag":null,"topics":["binding","linux","loader","opengl","public-domain","single-file","win32","windows"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mackron.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}},"created_at":"2019-03-14T09:51:02.000Z","updated_at":"2024-04-11T00:35:00.000Z","dependencies_parsed_at":"2022-09-25T22:18:04.091Z","dependency_job_id":null,"html_url":"https://github.com/mackron/glbind","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/mackron%2Fglbind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fglbind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fglbind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fglbind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mackron","download_url":"https://codeload.github.com/mackron/glbind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224622091,"owners_count":17342328,"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":["binding","linux","loader","opengl","public-domain","single-file","win32","windows"],"created_at":"2024-11-14T12:35:10.521Z","updated_at":"2024-11-14T12:35:11.335Z","avatar_url":"https://github.com/mackron.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch4 align=\"center\"\u003eA single file OpenGL header and API loader.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://discord.gg/9vpqbjU\"\u003e\u003cimg src=\"https://img.shields.io/discord/712952679415939085?label=discord\u0026logo=discord\u0026style=flat-square\" alt=\"discord\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://fosstodon.org/@mackron\"\u003e\u003cimg src=\"https://img.shields.io/mastodon/follow/109293691403797709?color=blue\u0026domain=https%3A%2F%2Ffosstodon.org\u0026label=mastodon\u0026logo=mastodon\u0026style=flat-square\" alt=\"mastodon\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nglbind includes a full implementation of the OpenGL headers (auto-generated from the OpenGL spec) so there's no need\nfor the offical headers or SDK. Unlike the official headers, the platform-specific sections are all contained within\nthe same file.\n\n\nUsage\n=====\nglbind is a single file library with no dependencies. There's no need to link to any libraries, nor do you need to\ninclude any other headers. Everything you need is included in `glbind.h`.\n```c\n#define GLBIND_IMPLEMENTATION\n#include \"glbind.h\"\n\nint main()\n{\n    GLenum result = glbInit(NULL, NULL);\n    if (result != GL_NO_ERROR) {\n        printf(\"Failed to initialize glbind.\");\n        return -1;\n    }\n    \n    ...\n    \n    glClearColor(0, 0, 0, 0);\n    glClear(GL_COLOR_BUFFER_BIT);\n\n    ...\n\n    glbUninit();\n    return 0;\n}\n```\nThe example above binds everything to global scope and uses default settings for the internal rendering context. You\ncan also initialize glbind like the code below.\n```c\nGLBapi gl;\nGLBconfig config = glbConfigInit();\nconfig.singleBuffered = GL_TRUE;    /* Don't use double-buffering on the internal rendering context. */\nGLenum result = glbInit(\u0026gl, \u0026config);\nif (result != GL_NO_ERROR) {\n    ... error initializing glbind ...\n}\n\n#if defined(GLBIND_WGL)\nHGLRC hRC = glbGetRC();\n... do something with hRC ...\n#endif\n\n#if defined(GLBIND_GLX)\nGLXContext rc = glbGetRC();\n... do something with rc ...\n#endif\n\n/* Draw something using local function pointers in the \"gl\" object instead of global scope. */\ngl.glClearColor(0, 0, 0, 0);\ngl.glClear(GL_COLOR_BUFFER_BIT);\n```\nSince OpenGL requires a rendering context in order to retrieve function pointers, it makes sense to give the client\naccess to it so they can avoid wasting time and memory creating their own rendering context unnecessarily. Therefore,\nglbind allows you to configure the internal rendering context and retrieve a handle to it so the application can\nmake use of it.\n\nYou can also initialize a `GLBapi` object against the current context (previously set with wglMakeCurrent or\nglXMakeCurrent) using `glbInitContextAPI()` or `glbInitCurrentContextAPI()`. Note, however, that before calling these\nfunctions you must have previously called `glbInit()`. These also do not automatically bind anything to global scope.\n\nYou can explicitly bind the function pointers in a `GLBapi` object to global scope by using `glbBindAPI()`.\n\nLicense\n=======\nPublic domain or MIT-0 (No Attribution). Choose whichever you prefer.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackron%2Fglbind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmackron%2Fglbind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackron%2Fglbind/lists"}