{"id":28961378,"url":"https://github.com/erlangsters/glfw","last_synced_at":"2026-05-20T05:34:28.142Z","repository":{"id":299711188,"uuid":"916474504","full_name":"erlangsters/glfw","owner":"erlangsters","description":"GLFW binding for the BEAM (Erlang and Elixir).","archived":false,"fork":false,"pushed_at":"2025-06-17T22:53:47.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T23:31:43.354Z","etag":null,"topics":["beam","binding","elixir","erlang","erlangsters","glfw"],"latest_commit_sha":null,"homepage":"https://about.erlangsters.org","language":"Erlang","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/erlangsters.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2025-01-14T07:00:58.000Z","updated_at":"2025-06-17T22:53:51.000Z","dependencies_parsed_at":"2025-06-17T23:41:49.234Z","dependency_job_id":null,"html_url":"https://github.com/erlangsters/glfw","commit_stats":null,"previous_names":["erlangsters/glfw"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erlangsters/glfw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangsters%2Fglfw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangsters%2Fglfw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangsters%2Fglfw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangsters%2Fglfw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erlangsters","download_url":"https://codeload.github.com/erlangsters/glfw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangsters%2Fglfw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261589908,"owners_count":23181434,"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":["beam","binding","elixir","erlang","erlangsters","glfw"],"created_at":"2025-06-24T02:02:40.210Z","updated_at":"2026-05-20T05:34:28.102Z","avatar_url":"https://github.com/erlangsters.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GLFW binding for the BEAM\n\n\u003e [!WARNING]\n\u003e :construction: It's still in development and a first beta version will be\n\u003e available shortly. The master branch will be rewound!\n\n\u003e [!IMPORTANT]\n\u003e This binding will not work on macOS.\n\n[![Erlangsters Repository](https://img.shields.io/badge/erlangsters-glfw-%23a90432)](https://github.com/erlangsters/glfw)\n![Supported Erlang/OTP Versions](https://img.shields.io/badge/erlang%2Fotp-28-%23a90432)\n![Current Version](https://img.shields.io/badge/version-0.1.0-%23354052)\n![License](https://img.shields.io/github/license/erlangsters/glfw)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/erlangsters/glfw/workflow.yml)](https://github.com/erlangsters/glfw/actions/workflows/workflow.yml)\n[![Documentation Link](https://img.shields.io/badge/documentation-available-yellow)](http://erlangsters.github.io/glfw/)\n\nA binding of [GFLW](https://www.glfw.org/) version 3.4 for the Erlang and\nElixir programming language. It's designed to work exclusively with the EGL 1.5\n[binding](https://github.com/erlangsters/egl-1.5) and, indirectly, with one of\nthe OpenGL [bindings](https://github.com/orgs/erlangsters/repositories?type=all\u0026q=opengl-).\n\n```erlang\nglfw:init().\n{ok, Window} = glfw:create_window(640, 480, \"Hello, World!\").\n```\n\nIt's a a thread-safe and idiomatic binding that is not generated. It's tested\nto work flawlessly on Linux, macOs and Windows.\n\n\u003e For very good reasons, this binding has its limitations and will remain this\n\u003e way. For instance, it does not expose Vulkan-related features, and it limits\n\u003e you to contextless windows.\n\nWritten by the Erlangsters [community](https://about.erlangsters.org/) and\nreleased under the MIT [license](/https://opensource.org/license/mit).\n\nXXX: Implement child windows.\n\nXXX: Verify/clarify  how glfwTerminate() could corrupt the BEAM by invalidating\n     pointer to exisitng resource (cursor, window, etc).\n\nXXX: What happens if monitor resource sent in the monitor callback, then later\n     another retrieve with monitors/0. Should they be shared ?\n\nXXX: Verify it builds on earlier version of GLFW (version 3.3 on debian 12 for instance).\n\nXXX: Should time-related functions be implemented\n\n- glfwGetTimerFrequency\n- glfwGetTimerValue\n- glfwGetTime\n- glfwSetTime\n\nIt's for GLFW version 3.4, however it will compile fine with previous version.\nJust make sure not to  use features if linking against earlier version. Use the\n`glfw:version()`.\n\n\nFor more example, consult the test/ folder.\n\n\n## Getting started\n\nAn example will speak louder than words.\n\n```erlang\nglfw:init().\n{ok, Window} = glfw:create_window(800, 600, \"Hello, GLFW!\").\n\nglfw:set_key_handler(Window, self()).\nwindow_loop(Window).\n```\n\n\u003e Notice how the concept of \"callbacks\" is replaced with \"handlers\". Instead of\n\u003e functions being called, we register a process which then receives the events\n\u003e as BEAM messages to process them asynchronously.\n\nHere is how the main loop could look like.\n\n```erlang\nloop_window(Window) -\u003e\ncase glfw:window_should_close(Window) of\n     true -\u003e\n          glfw:terminate();\n     false -\u003e\n          glfw:poll_events(),\n          handle_events(Window),\n          loop_window(Window)\nend.\n```\n\nHere is how processing events could look like.\n\n\n```erlang\n\nhandle_events(Window) -\u003e\n     receive\n          #glfw_key{window=Window, key={X, Y}} -\u003e\n          glfw:window_should_close(Window, true),\n          handle_events(Window);\n     after 0 -\u003e\n          ok\n     end.\n```\n\nNote about contextless window.\n\n```erlang\nWindowHandle = glfw:window_egl_handle(Window).\n{ok, Surface} = egl:create_window_surface(Display, Config, WindowHandle, []).\n```\n\nTo be written.\n\nAn effort to provide an adapted documentation was made, and therefore you can\nrely on the binding's documentation.\n\n## Contextless windows\n\nTo be written.\n\nFor more information, consult this [document](/docs/contextless-windows.md).\n\n## Thread safety\n\nTo be written.\n\nFor more information, consult this [document](/docs/thread-safety.md).\n\n## API mapping\n\nThis is a binding to a C API that has been slightly adapted to feel more\nnatural when used in Erlang and Elixir.\n\n\u003e Your existing GLFW knowledge still applies.\n\nThe changes are minor and shouldn’t cause any issues. With the API reference,\nyou should have everything you need.\n\nIf you run into difficulties, check the API mapping document for details on how\nfunctions and types are mapped.\n\nAdditionally, the test suite in this repository serves as a useful reference\nfor practical examples of GLFW functions in action.\n\n## Test demos\n\nIt's hard to put GLFW under automated unit tests since it's heavily stateful\nand requires a graphical environment which is hard to emulate in Github\nrunners.\n\nHowever, this binding comes with a limited set of unit tests that should\nalready indicate a great deal whether GLFW works on your system.\n\n- `rebar3 eunit -m glfw_test` - Test the initialization-related functions of the API\n- `rebar3 eunit -m glfw_monitor_test` - Test the monitor-related functions of the API\n\nAdditionally, it comes with interactive mini \"test demos\" that can be used to\nquickly test various part of the binding on your system.\n\n- `rebar3 as test shell --eval 'test_glfw_joystick:run().'` - To test Joystick/Gamepad\n- `rebar3 as test shell --eval 'test_glfw_joystick:run().'` - To test Joystick/Gamepad\n- `rebar3 as test shell --eval 'test_glfw_joystick:run().'` - To test Joystick/Gamepad\n- `rebar3 as test shell --eval 'test_glfw_joystick:run().'` - To test Joystick/Gamepad\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlangsters%2Fglfw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferlangsters%2Fglfw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlangsters%2Fglfw/lists"}