{"id":19308543,"url":"https://github.com/dcronqvist/dotgl","last_synced_at":"2026-01-05T16:08:05.347Z","repository":{"id":169912082,"uuid":"645994566","full_name":"dcronqvist/DotGL","owner":"dcronqvist","description":"👾 a low level OpenGL 4.6 binding for C#","archived":false,"fork":false,"pushed_at":"2024-03-25T19:46:51.000Z","size":282,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T09:45:04.039Z","etag":null,"topics":["binding","csharp","opengl","wrapper"],"latest_commit_sha":null,"homepage":"","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/dcronqvist.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":"2023-05-27T00:45:38.000Z","updated_at":"2024-02-15T20:51:07.000Z","dependencies_parsed_at":"2024-03-25T20:45:18.488Z","dependency_job_id":null,"html_url":"https://github.com/dcronqvist/DotGL","commit_stats":null,"previous_names":["dcronqvist/dotgl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcronqvist%2FDotGL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcronqvist%2FDotGL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcronqvist%2FDotGL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcronqvist%2FDotGL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcronqvist","download_url":"https://codeload.github.com/dcronqvist/DotGL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245204853,"owners_count":20577422,"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","csharp","opengl","wrapper"],"created_at":"2024-11-10T00:15:20.090Z","updated_at":"2026-01-05T16:08:05.307Z","avatar_url":"https://github.com/dcronqvist.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 👾 DotGL\n\nA low level OpenGL 4.6 binding for C#. Contains exact function signatures (unsafe with pointers) and safe wrappers for all OpenGL functions. Allows for configuring which functions to expose (unsafe/safe or both) and which OpenGL version to target.\n\n## How to use\n\n#### Include script\n\nThe easiest way to include this binding in your project is to use the [Include.ps1](Include.ps1) script. The script will download the latest [GL.cs](/GL.cs) file, and put it next to your `.csproj` file. It will also add the necessary configuration to your `.csproj` file.\n\nThe following command can be run either in the same directory as the `.csproj` file you wish to include it for, or next to the `.sln` file, where it will be simply include it in the first `.csproj` file it finds. **Note: Please review and make sure you understand the consequences of running commands you find on the internet before executing them.**\n\n```powershell\n$(iwr \"https://raw.githubusercontent.com/dcronqvist/DotGL/master/Include.ps1\").Content | iex\n```\n\n#### Manually\n\n1. Download the [GL.cs](/GL.cs) file and add it to your project somewhere.\n2. Include the following in your `.csproj` file.\n    - Configure `OpenGLVersionMajor` and `OpenGLVersionMinor` to your desired OpenGL version.\n    - Configure `OpenGLProfile` to either `CORE` or `COMPAT`. (`COMPAT` not implemented yet)\n    - Configure `OpenGLWrapperAPI` to either `SAFE`, `UNSAFE` or `BOTH`.\n3. Make sure to add `\u003cAllowUnsafeBlocks\u003etrue\u003cAllowUnsafeBlocks\u003e` to your `.csproj` file if you want to use the unsafe functions.\n\n```xml\n\u003cProject ...\u003e\n    ...\n    \u003cPropertyGroup\u003e\n        \u003c!-- GL.cs configuration options! --\u003e\n\n        \u003c!-- Profile: CORE/COMPAT --\u003e\n        \u003c!-- COMPAT not implemented yet --\u003e\n        \u003cOpenGLProfile\u003eCORE\u003c/OpenGLProfile\u003e\n\n        \u003c!-- Version: Any valid OpenGL version from 1.0-4.6 --\u003e\n        \u003cOpenGLVersionMajor\u003e3\u003c/OpenGLVersionMajor\u003e\n        \u003cOpenGLVersionMinor\u003e3\u003c/OpenGLVersionMinor\u003e\n\n        \u003c!-- Defining exposed wrapper API (SAFE/UNSAFE/BOTH) --\u003e\n        \u003c!-- SAFE: Only safe functions are exposed --\u003e\n        \u003c!-- UNSAFE: Only unsafe functions are exposed --\u003e\n        \u003c!-- BOTH: Both safe and unsafe functions are exposed --\u003e\n        \u003cOpenGLWrapperAPI\u003eBOTH\u003c/OpenGLWrapperAPI\u003e\n\n        \u003c!-- Defining constants for compile time availability of APIs --\u003e\n        \u003cDefineConstants\u003e$(DefineConstants);OGL_V_$(OpenGLVersionMajor)_$(OpenGLVersionMinor);OGL_P_$(OpenGLProfile);OGL_WRAPPER_API_$(OpenGLWrapperAPI)\u003c/DefineConstants\u003e\n    \u003c/PropertyGroup\u003e\n    ...\n\u003c/Project\u003e\n```\n\n4. Done!\n\n## Example with [DotGLFW](https://github.com/dcronqvist/DotGLFW)\n\nThe following example shows how to use this binding with [DotGLFW](https://github.com/dcronqvist/DotGLFW). The example is not complete, but should give a good idea of how this binding is supposed to be set up and used.\n\n```csharp\n// Gives access to all OpenGL functions without the `GL.` prefix\nusing static DotGL.GL; \n\n// Retrieve OpenGL version and profile from `.csproj` file\n// Does some switching depending on which constants are defined\nint glMajor = GL.GetProjectOpenGLVersionMajor();\nint glMinor = GL.GetProjectOpenGLVersionMinor();\nstring glProfile = GL.GetProjectOpenGLProfile();\n\n// Normal GLFW window creation\nGlfw.Init();\nGlfw.WindowHint(Hint.ClientAPI, ClientAPI.OpenGLAPI);\nGlfw.WindowHint(Hint.ContextVersionMajor, glMajor);\nGlfw.WindowHint(Hint.ContextVersionMinor, glMinor);\nOpenGLProfile profile = glProfile switch\n{\n    \"CORE\" =\u003e OpenGLProfile.CoreProfile,\n    \"COMPAT\" =\u003e OpenGLProfile.CompatProfile,\n    _ =\u003e throw new Exception(\"Invalid OpenGL profile!\")\n}\nGlfw.WindowHint(Hint.OpenGLProfile, profile);\nWindow window = Glfw.CreateWindow(800, 600, \"DotGL\", Monitor.NULL, Window.NULL);\n\n// Set the current context to the newly created window\nGlfw.MakeContextCurrent(window);\n\n// Load all OpenGL functions for the given version and profile\nGL.Import(Glfw.GetProcAddress);\n\n// OpenGL functions now working!\nglClearColor(0.2f, 0.3f, 0.3f, 1.0f);\nglClear(GL_COLOR_BUFFER_BIT);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcronqvist%2Fdotgl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcronqvist%2Fdotgl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcronqvist%2Fdotgl/lists"}