{"id":16734632,"url":"https://github.com/PaoloMazzon/Vulkan2D","last_synced_at":"2025-10-31T22:30:20.847Z","repository":{"id":56738813,"uuid":"286360560","full_name":"PaoloMazzon/Vulkan2D","owner":"PaoloMazzon","description":"2D renderer written in C utilizing Vulkan","archived":false,"fork":false,"pushed_at":"2025-02-06T00:41:01.000Z","size":120177,"stargazers_count":210,"open_issues_count":0,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-06T01:27:13.768Z","etag":null,"topics":["2d-renderer","c","gamedev","graphics","graphics-programming","rendering","sdl2","shaders","vulkan"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaoloMazzon.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":"2020-08-10T02:49:51.000Z","updated_at":"2025-02-06T00:40:38.000Z","dependencies_parsed_at":"2024-04-30T21:57:44.060Z","dependency_job_id":"9e7cab63-c8a8-4ce0-92d0-97a8b8da36e6","html_url":"https://github.com/PaoloMazzon/Vulkan2D","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/PaoloMazzon%2FVulkan2D","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaoloMazzon%2FVulkan2D/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaoloMazzon%2FVulkan2D/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaoloMazzon%2FVulkan2D/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaoloMazzon","download_url":"https://codeload.github.com/PaoloMazzon/Vulkan2D/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239236414,"owners_count":19604902,"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":["2d-renderer","c","gamedev","graphics","graphics-programming","rendering","sdl2","shaders","vulkan"],"created_at":"2024-10-13T00:00:49.601Z","updated_at":"2025-10-31T22:30:20.719Z","avatar_url":"https://github.com/PaoloMazzon.png","language":"C","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"![basic demo](https://i.imgur.com/InP0Sou.gif)\r\n\r\n![gif](https://github.com/user-attachments/assets/ae0f05fd-7679-4061-ac89-dce66e163232)\r\n\r\n![example](https://github.com/user-attachments/assets/186de874-6f2f-47c4-8a58-52c14148bb46)\r\n\r\n![example](https://github.com/user-attachments/assets/9a43483b-0bdd-4511-98a3-9ca839b070d5)\r\n\r\nVulkan2D\r\n========\r\n[Vulkan2D](https://github.com/PaoloMazzon/Vulkan2D) is a 2D renderer using Vulkan and SDL2 primarily for C games. VK2D aims for an extremely\r\nsimple API, requiring no Vulkan experience to use. [Astro](https://github.com/PaoloMazzon/Astro)\r\nand more recently [Sea of Clouds](https://devplo.itch.io/sea-of-clouds) internally use Vulkan2D for\r\nrendering. My other projects [Bedlam](https://github.com/PaoloMazzon/Bedlam), \r\n[Spacelink](https://github.com/PaoloMazzon/Spacelink), and\r\n[Peace \u0026 Liberty](https://github.com/PaoloMazzon/PeacenLiberty) also used Vulkan2D, although\r\na much older version of it. Check out the [quick-start](docs/QuickStart.md) guide.\r\n\r\nFeatures\r\n========\r\n\r\n + Simple, fast, and intuitive API built on top of SDL\r\n + Draw shapes/textures/3D models/arbitrary polygons to the screen or to other textures\r\n + Fast, built with Vulkan 1.2 and doesn't require any device features (but it can make use of some)\r\n + Simple and fully-featured cameras, allowing for multiple concurrent cameras\r\n + Powerful and very simple shader interface\r\n + Simple access to the Vulkan implementation through `VK2D/VulkanInterface.h`\r\n + Hardware-accelerated 2D light and shadows\r\n\r\nDocumentation\r\n=============\r\nCheck out the [documentation website](https://paolomazzon.github.io/Vulkan2D/index.html).\r\n\r\nUsage\r\n=====\r\nThere are two parts to building it with your project: you must build VK2D and also VMA since\r\nVK2D needs VMA to function. You'll likely need to do something like this in CMake:\r\n\r\n```cmake\r\nset(VMA_FILES VK2D/VulkanMemoryAllocator/src/vk_mem_alloc.h VK2D/VulkanMemoryAllocator/src/VmaUsage.cpp)\r\nfile(GLOB VK2D_FILES VK2D/VK2D/*.c)\r\n...\r\ninclude_directories(... Vulkan2D/ VulkanMemoryAllocator/src/)\r\nadd_executable(... ${VK2D_FILES} ${VMA_FILES})\r\n```\r\n\r\nVulkan2D also requires the following external dependencies:\r\n\r\n    SDL2, 2.0.6+\r\n    Vulkan 1.1+\r\n    C11 + C standard library\r\n    C++17 (VMA uses C++17)\r\n\r\nExample\r\n=======\r\n\r\nBy default the program automatically crashes on fatal errors, but you may specify Vulkan2D to not do\r\nthat and check for errors on your own. The following example uses default settings meaning that if there\r\nis an error in VK2D, it will print the status to `vk2derror.txt` and quit. \r\n\r\n```c\r\nSDL_Window *window = SDL_CreateWindow(\"VK2D\", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_VULKAN);\r\nSDL_Event e;\r\nVK2DRendererConfig config = {VK2D_MSAA_32X, VK2D_SCREEN_MODE_TRIPLE_BUFFER, VK2D_FILTER_TYPE_NEAREST};\r\nvk2dRendererInit(window, config, NULL);\r\nvec4 clearColour;\r\nvk2dColourHex(clearColour, \"#59d9d7\");\r\nbool stopRunning = false;\r\n\r\n// Load your resources\r\n\r\nwhile (!stopRunning) {\r\n    while (SDL_PollEvent(\u0026e)) {\r\n        if (e.type == SDL_QUIT) {\r\n            stopRunning = true;\r\n        }\r\n    }\r\n\r\n    vk2dRendererStartFrame(clearColour);\r\n\r\n    // Draw your things\r\n\r\n    vk2dRendererEndFrame();\r\n}\r\n\r\nvk2dRendererWait();\r\n\r\n// Free your resources\r\n\r\nvk2dRendererQuit();\r\nSDL_DestroyWindow(window);\r\n```\r\n\r\nIf you don't want VK2D to crash on errors you may specify that in the struct `VK2DStartupOptions` passed to\r\n`vk2dRendererInit` and check for errors yourself with `vk2dStatus`, `vk2dStatusMessage`, and\r\n`vk2dStatusFatal`. Any VK2D function can raise fatal errors but unless you pass bad pointers\r\nto VK2D functions, they will not crash if there is a fatal error and will instead simply do\r\nnothing.\r\n\r\nRunning the Examples\r\n====================\r\nAll examples are tested to work on Windows and Ubuntu. The `CMakeLists.txt` at the root\r\ndirectory will generate build systems for each example. Be sure to compile the test \r\nshader before running the `examples/main/` example with:\r\n\r\n    glslc assets/test.frag -o assets/test.frag.spv\r\n    glslc assets/test.vert -o assets/test.vert.spv\r\n\r\nIf you don't trust binary blobs you may also compile the binary shader blobs with the command\r\n\r\n    genblobs.py colour.vert colour.frag instanced.vert instanced.frag model.vert model.frag shadows.vert shadows.frag spritebatch.comp\r\n\r\nrun from the `shaders/` folder (requires Python).\r\n\r\nRoadmap\r\n=======\r\n\r\n + Asynchronous loading\r\n + Ability to disable 3D resources\r\n + GPU readback\r\n + Soft shadows\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaoloMazzon%2FVulkan2D","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPaoloMazzon%2FVulkan2D","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaoloMazzon%2FVulkan2D/lists"}