{"id":50554807,"url":"https://github.com/bigmat18/bgfx-lines","last_synced_at":"2026-06-04T06:01:56.986Z","repository":{"id":242109160,"uuid":"808192185","full_name":"bigmat18/bgfx-lines","owner":"bigmat18","description":"Implementation of algorithms to draw lines in different shape a size without using any primitive in API but with bgfx","archived":false,"fork":false,"pushed_at":"2025-09-25T00:29:39.000Z","size":1349,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T02:38:20.540Z","etag":null,"topics":["cmake","cpp","rendering","shaders"],"latest_commit_sha":null,"homepage":"https://www.canva.com/design/DAGf9IzYEwI/3owBkRHI0qNNT_RI0JQX9Q/edit?utm_content=DAGf9IzYEwI\u0026utm_campaign=designshare\u0026utm_medium=link2\u0026utm_source=sharebutton","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/bigmat18.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-30T15:07:47.000Z","updated_at":"2025-09-25T00:29:43.000Z","dependencies_parsed_at":"2024-09-16T15:51:36.034Z","dependency_job_id":"9657829f-6987-43a7-b925-99dc2bd8e779","html_url":"https://github.com/bigmat18/bgfx-lines","commit_stats":null,"previous_names":["bigmat18/bgfx-lines"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bigmat18/bgfx-lines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmat18%2Fbgfx-lines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmat18%2Fbgfx-lines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmat18%2Fbgfx-lines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmat18%2Fbgfx-lines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmat18","download_url":"https://codeload.github.com/bigmat18/bgfx-lines/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmat18%2Fbgfx-lines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33891733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cmake","cpp","rendering","shaders"],"created_at":"2026-06-04T06:01:56.404Z","updated_at":"2026-06-04T06:01:56.980Z","avatar_url":"https://github.com/bigmat18.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BGFX Lines Rendering\n\n## 1. Introduction\n\nBGFX Lines is an **open-source**, **general-purpose**, **multi-platform** C++ library for\nrendering lines and polylines with variable thickness, custom caps, joins, and\nadvanced visual effects—without relying on native API line primitives.\nDeveloped as part of my Bachelor’s degree final exam, the project leverages the\nbgfx cross-platform rendering library and demonstrates multiple algorithms for\nefficient and high-quality line rendering.\n\n- No API line primitives used (fully custom)\n- Supports variable thickness, caps, joins, borders\n- Multiple CPU/GPU implementations including instancing and compute\n\n## 2. Papers, Libraries, and Requirements\n\n### Papers \u0026 References\n\n- bgfx: Cross-platform rendering library — https://github.com/bkaradzic/bgfx\n- bx — https://github.com/bkaradzic/bx\n- bimg (optional) — https://github.com/bkaradzic/bimg\n- https://www.labri.fr/perso/nrougier/python-opengl/#rendering-lines\n- https://www.yumpu.com/en/document/read/55443281/opengl-blueprint-rendering\n- https://jcgt.org/published/0002/02/08/\n- https://developer.nvidia.com/gpugems/gpugems2/part-iii-high-quality-rendering/chapter-22-fast-prefiltered-lines\n\n### Requirements\n\n- C++17 or newer\n- CMake ≥ 3.15\n- Supported OS: Windows, Linux, macOS (others may work)\n- GPU backend supported by bgfx (OpenGL, Direct3D, Vulkan, Metal)\n- Shader model and compute support required for GPU-generated paths\n\n## 3. Features\n\n- Variable-width lines and polylines\n- Caps (butt/round/square), joins (miter/bevel/round), borders/outlines\n- Anti-aliased rendering strategies\n- Five rendering approaches:\n  - CPU-Generated: buffers generated on CPU, classical draw\n  - GPU-Generated: buffers generated via compute shaders, then drawn\n  - CPU Instancing: CPU data + instanced rendering\n  - GPU Instancing: GPU compute + instanced rendering\n  - Texture Instancing: instance data via texture buffer (TBO/SSBO)\n- General-purpose, multi-platform, bgfx-based\n- Modular design for easy integration into existing engines/tools\n\n## 4. Installation and Usage\n\n### 4.1. Getting the Source\n\n```bash\ngit clone --recursive https://github.com/youruser/bgfx-lines.git\ncd bgfx-lines\n```\n\nIf you forgot `--recursive`, run:\n\n```bash\ngit submodule update --init --recursive\n```\n\n### 4.2. Building\n\n```bash\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build --config Release\n```\n\nArtifacts:\n- Static/dynamic library target(s) for integration\n- Example/demo executables (if enabled)\n\nOptional CMake options (create as needed):\n- `-DLINES_BUILD_EXAMPLES=ON`\n- `-DLINES_BUILD_TESTS=ON`\n\n### 4.3. Minimal Usage Example\n\n```cpp\nstd::vector\u003clines::LinesVertex\u003e points;\ngeneratePointsInCube(points, 3, 100);\nline = std::make_unique\u003clines::InstancingLines\u003e(points);\nline-\u003esettings().setThickness(5);\nline-\u003esettings().setBorder(2);\nline-\u003esettings().setAntialias(0);\nline-\u003esettings().setLeftCap(lines::LineCap::TRIANGLE_CAP);\nline-\u003esettings().setRigthCap(lines::LineCap::ROUND_CAP);\nline-\u003esettings().setColorToUse(lines::LineColorToUse::PER_VERTEX_COLOR);\nline-\u003esettings().setGeneralColor(lines::LinesVertex::COLOR(1, 0, 1, 1));\n\n\nwhile (running) {\n    // ... bgfx frame prep ...\n    bgfx::touch(0);\n    line-\u003edraw(0);\n    bgfx::frame();\n}\n// Cleanup lines and bgfx...\n```\n\nSee the `examples/` folder for fully working samples per backend.\n\n## 5. Results\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" width=\"380\"\u003e\n      \u003cimg src=\"images/cube.png\" width=\"380\"/\u003e\u003cbr\u003e\n      \u003csub\u003eRendering of 500.000 lines visual effect and update each 1.0 sec\u003c/sub\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" width=\"400\"\u003e\n      \u003cimg src=\"images/graph.png\" width=\"400\"/\u003e\u003cbr\u003e\n      \u003csub\u003eRendering of a Graph using custom lines and polylines system with visual effects\u003c/sub\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" width=\"300\"\u003e\n      \u003cimg src=\"images/wireframe.jpg\" width=\"300\"/\u003e\u003cbr\u003e\n      \u003csub\u003eRendering of a model wireframe using custom lines with 5px thickness\u003c/sub\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/div\u003e\n\n## 6. Benchmark and Performance Analysis\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" width=\"350\"\u003e\n      \u003cimg src=\"images/static-buffer-1.png\" width=\"350\"/\u003e\u003cbr\u003e\n      \u003csub\u003eDelta Time absulute value with static buffers (no-updates)\u003c/sub\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" width=\"350\"\u003e\n      \u003cimg src=\"images/static-buffer-2.png\" width=\"350\"/\u003e\u003cbr\u003e\n      \u003csub\u003eDelta Time compared with reference implementation with static buffers (no-updates)\u003c/sub\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" width=\"350\"\u003e\n      \u003cimg src=\"images/dynamic-buffer-1.png\" width=\"350\"/\u003e\u003cbr\u003e\n      \u003csub\u003eDelta Time absulute value with dynamic buffers (updates)\u003c/sub\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" width=\"350\"\u003e\n      \u003cimg src=\"images/dynamic-buffer-2.png\" width=\"350\"/\u003e\u003cbr\u003e\n      \u003csub\u003eDelta Time compared with reference implementation with dynamic buffers (updates)\u003c/sub\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmat18%2Fbgfx-lines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmat18%2Fbgfx-lines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmat18%2Fbgfx-lines/lists"}