{"id":25024811,"url":"https://github.com/challanger524/chernoopengl-cmake","last_synced_at":"2025-04-13T10:56:30.955Z","repository":{"id":40392703,"uuid":"506997052","full_name":"Challanger524/ChernoOpenGL-CMake","owner":"Challanger524","description":"Cross-platform restoration of TheCherno OpenGL YouTube series with perfect commit history (link to YouTube OpenGL playlist by The Cherno below)","archived":false,"fork":false,"pushed_at":"2025-01-23T23:03:19.000Z","size":449,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T02:11:25.605Z","etag":null,"topics":["cherno","cmake","cpp","cpp17","graphics-programming","graphics2d","imgui","learning","lessons","opengl","perfect-commits","perfect-history","rebase-warning","thecherno"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/playlist?list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Challanger524.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}},"created_at":"2022-06-24T12:10:33.000Z","updated_at":"2025-02-17T12:28:19.000Z","dependencies_parsed_at":"2024-03-17T01:12:59.269Z","dependency_job_id":"b2934194-8fe5-43a7-9adc-ff08547f544a","html_url":"https://github.com/Challanger524/ChernoOpenGL-CMake","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/Challanger524%2FChernoOpenGL-CMake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Challanger524%2FChernoOpenGL-CMake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Challanger524%2FChernoOpenGL-CMake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Challanger524%2FChernoOpenGL-CMake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Challanger524","download_url":"https://codeload.github.com/Challanger524/ChernoOpenGL-CMake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703194,"owners_count":21148116,"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":["cherno","cmake","cpp","cpp17","graphics-programming","graphics2d","imgui","learning","lessons","opengl","perfect-commits","perfect-history","rebase-warning","thecherno"],"created_at":"2025-02-05T16:32:14.864Z","updated_at":"2025-04-13T10:56:30.936Z","avatar_url":"https://github.com/Challanger524.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChernoOpenGL-CMake\n\n**CMake**-based implementation of TheCherno's [OpenGL series](https://www.youtube.com/playlist?list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2) with minimal code deviance according to videos.\n\n## Features\n\n- **C++ 17**\n- **CMake** - cross-platform build system\n\t- cross-platform dependencies handling\n\t- tested on:\n\t\t- Windows 10 - `Visual Studio 2022`, `VS Code v1.86`: `MSVC` 19.34, `Clang` 17.0.4, `GCC` 13.2 (Rev2, Built by MSYS2 project)\n\t\t- Linux Mint 20 - `VS Code v1.75`: `GCC` 9.4, `Clang` 10.0\n\t\t- MacOS (Mac Mini M2) - `VS Code`: `GCC`, `Apple-Clang`\n- **perfect commits** - reached through git-history rewriting\n\t- pros: clean diffs between commits (best for learn-repositories)\n\t- pros: no typo/logic fixing or improving separate commits\n\t- cons: unstable (ever changing) commit _hashes_ and _timestamps_\n\t- commands:\n\t\t- `rebase -i \u003ccommit\u003e~`/`rebase -i --root`; (then follow `status` hints)\n\t\t- `git rm \u003csubmodule_path\u003e` # the only way to change submodule \\\u003cname\\\u003e field\n\t\t- `git filter-repo --refs \u003cbranch\u003e --replace-text \u003c(echo 'regex:Dependencies/==\u003edeps/')`\n\t\t- `git filter-repo --refs \u003cbranch\u003e --replace-text \u003c(echo 'regex:^\\xEF\\xBB\\xBF==\u003e')` # strip BOM\n\t\t- see [doc/note.sh](doc/note.sh) for other commands and use cases\n- **git submodules** - each dependency present as a submodule\n\t- much clear dependency-introduction commits\n\t- up-to-date source of dependencies' repositories\n\t- no need for additional downloads during the install stage\n\n### Differences\n\n- **header-only** due to my laziness :) - more compact codebase :+1:\n- **error-logging** - debug output with `GL_KHR_debug`:`glDebugMessageCallback()` (if possible):\n\t- debugging stuff moved from `Renderer.hpp` to new `Utility.hpp`\n\t- detailed GPU-vendor error description with **debug output**:\n\t\t- can be implemented in OpenGL versions prior to 4.3 (by GPU-vendor)\n\t\t- worked on OpenGL 4.0 (Intel CPU) (on old tiny laptop)\n- **imgui docking** branch - allows moving imgui-windows outside and to dock them to each other\n- **batch rendering** episodes - adopted with last 4 commits\n\t- The Cherno explained with non-related source code (repository)\n- some **stl::type_traits** related bragging :sunglasses: (`Utility.hpp`: `GLASSERT(\u003cgl_(un)signed_int_ret\u003e)` macro)\n\n### Debatable\n\n- headers-definitions (without sources), single `.cpp` file with `int main()`\n\t- maybe allows to switch easier to the `C++20 modules`\n\n\u003e All _concerns_ can be expressed via GitHub [Project's Issues](https://github.com/Challanger524/ChernoOpenGL-CMake/issues) (one issue per concern)\n\n## Clone\n``` shell\ngit clone --recurse --shallow-submodules \"https://github.com/Challanger524/ChernoOpenGL-CMake.git\"\n```\n\n## Prerequisites\n\n- **CMake** - cross-platform build automation system\n\t- (for minimal version see [CMakeLists.txt#L1](CMakeLists.txt#L1))\n\u003c!-- @import \"CMakeLists.txt\" {line_begin=0 line_end=1} --\u003e\n- **Ninja** - small build system with a focus on speed\n- **C++ compiler** (any): MSVC / GCC / Clang\n- on GNU Linux:\n\t- install dev libs listed below and/or google CMake log for other required\n\t- `sudo apt-get install`: `libxi-dev libxrandr-dev libxcursor-dev libxinerama-dev libopengl-dev`\n\n## Build\n\n\u003cdetails\u003e\u003csummary\u003eVisual Studio\u003c/summary\u003e\n\nOfficial documentation: [CMake projects in Visual Studio](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170\u0026viewFallbackFrom=vs-2019)\n\n\u003e `C++ CMake tools for Windows` module must be installed (see docs [Installation](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170#installation) part)\n\n0. open the project folder with _Visual Studio_ (and enable CMake via dialog prompt, if any)\n0. in the upper toolbar choose `MSVC` configuration\n0. Project-\u003eConfigure ChernoOpenGL\n0. Build-\u003eBuild All\n0. set `CMakeLists.txt` as _Startup Item_ via _Solution Explorer_ (or see [Debugging CMake projects](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170#debugging-cmake-projects) part)\n0. Debug-\u003eStart Debugging\n\u003c/details\u003e\n\n\u003cp\u003e\n\u003cdetails\u003e\u003csummary\u003eVS Code\u003c/summary\u003e\n\nOfficial documentation: [Get started with CMake Tools on Linux](https://code.visualstudio.com/docs/cpp/cmake-linux) (less suitable article then as for Visual Studio)\n\n\u003e 1.`C/C++` and 2.`CMake Tools` extensions (by Microsoft) must be installed (see docs [Prerequisites](https://code.visualstudio.com/docs/cpp/cmake-linux#_prerequisites) part)\n\n\u003cdetails\u003e\u003csummary\u003eNote: on Windows...\u003c/summary\u003e\n\nwhen building with `msvc` preset, to rid off unconfigured preset messages - you need to [run VS Code from a Developer Command Prompt for Visual Studio](\nhttps://code.visualstudio.com/docs/cpp/config-msvc#_check-your-microsoft-visual-c-installation:~:text=To%20use%20MSVC%20from%20a%20command%20line%20or%20VS%20Code%2C%20you%20must%20run%20from%20a%20Developer%20Command%20Prompt%20for%20Visual%20Studio)\n\nI created a _shorcut_ to launch VS Code with next `Target`:\n```\n%comspec% /C \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat\" \u0026 code\n```\n\n\u003e with `/C` option it should close itself automatically, but sometimes it is not - so just close it manually after VS Code launched.\n\n\u003c/details\u003e\u003cp\u003e\n\n0. open the project folder\n0. configure from preset via dialog (CMake) prompt, or:\n\t- select preset - open Command Palette (`Ctrl+Shift+P`) and type `CMake: Select Configure Preset` then choose suitable\n\t- configure - open Command Palette (`Ctrl+Shift+P`) and type `CMake: Configure` (if not started automatically)\n0. build - open Command Palette (`Ctrl+Shift+P`) and type `CMake: Build `(or press a _build_ (:radio_button:) button in the bottom toolbar)\n0. run:\n\t- debug - open Command Palette (`Ctrl+Shift+P`) and type `CMake: Debug ` (or press `F5`) (or press a _debug_ :bug: (near :arrow_forward:) in the bottom toolbar)\n\t- launch (if debug is unavailable) - `Menu Bar-\u003eRun-\u003eRun Without Debugging` (or `Ctrl+F5`) (or :arrow_forward: button in the bottom toolbar)\n\u003c/details\u003e\n\n\u003cp\u003e\n\u003cdetails open\u003e\u003csummary\u003eCommand Line\u003c/summary\u003e\n\n\u003e Presets were introduced in `CMake 3.19`\n\n0. `cmake --list-presets`\n0. `cmake --preset \u003cpreset\u003e`\n0. `ninja -C out/build/\u003cpreset\u003e`\n0. `./ChernoOpenGL` (or `./ChernoOpenGL.exe` on _shWindows_)\n\u003c/details\u003e\n\n## Showcase\n#### Console output examples:\n\u003cdetails open\u003e\u003csummary\u003eMS Windows 10 (NVIDIA GTX 1060)\u003c/summary\u003e\n\n```\nInfo: Context: Debug - active (supported)\nInfo: GL: Extension: GL_KHR_debug - OK\n\nInfo: GLFW version: 3.4.0 Win32 WGL Null EGL OSMesa MinGW-w64\nInfo: GLEW version: 2.2.0\nInfo: GL   version: 3.3.0 NVIDIA 537.34\nInfo: GLSL version: 3.30 NVIDIA via Cg compiler\nInfo: GPU  vendor : NVIDIA Corporation\nInfo: Renderer    : NVIDIA GeForce GTX 1060 3GB/PCIe/SSE2\nInfo: ImGui version: 1.90.4 +docking +viewport\n\nTrace: Registering test: Clear Color\nTrace: Registering test: Texture 2D\nTrace: Registering test: Batching\nTrace: Registering test: Batching Textures\nTrace: Registering test: Batching Textures (dynamic)\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eApple Mac Mini M2\u003c/summary\u003e\n\n```\nInfo: Context: Debug - inactive (or unsupported)\n\nInfo: GLFW version: 3.4.0 Cocoa NSGL Null EGL OSMesa monotonic\nInfo: GLEW version: 2.2.0\nInfo: GL   version: 4.1 Metal - 88\nInfo: GLSL version: 4.10\nInfo: GPU  vendor : Apple\nInfo: Renderer    : Apple M2\nInfo: ImGui version: 1.90.4 +docking +viewport\n\nTrace: Registering test: Clear Color\nTrace: Registering test: Texture 2D\nTrace: Registering test: Batching\nTrace: Registering test: Batching Textures\n```\n\u003c/details\u003e\n\n#### Screenshots:\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test_menu\"        src=\"doc/img/test_menu.png\"\u003e       \u003cbr\u003e\u003cem\u003eTest Menu\u003c/em\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test-clear_color\" src=\"doc/img/test-clear_color.png\"\u003e\u003cbr\u003e\u003cem\u003eClear Color\u003c/em\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test-texture_2d\"  src=\"doc/img/test-texture_2d.png\"\u003e \u003cbr\u003e\u003cem\u003eTexture 2D\u003c/em\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test-batching\"    src=\"doc/img/test-batching.png\"\u003e   \u003cbr\u003e\u003cem\u003eBatching\u003c/em\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test-batching_textures\" src=\"doc/img/test-batching_textures.png\"\u003e\u003cbr\u003e\u003cem\u003eBatching Textures\u003c/em\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg alt=\"test-batching_textures_dynamic\" src=\"doc/img/test-batching_textures_dynamic.png\"\u003e\u003cbr\u003e\u003cem\u003eBatching Textures (dynamic)\u003c/em\u003e\u003c/p\u003e\n\n### Moral Ownership\n\n- `Cherno` `Hazel` logos and `Educational aspect` of the source code - belongs to **Yan Chernikov** [TheCherno](https://github.com/TheCherno) the way YouTube [OpenGL series](https://www.youtube.com/playlist?list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2) does\n- `restoration` `polishing` `fixing` `(over)correcting` `(for_perfectiest_solution) researhing` `(folder) structuring/renaming` `dependency managing` `perfect git-history keeping` `doc/ -umenting` `CMake -ing` `readme.md composing` `.editorconfig -ing` `.gitignore -ing` `cross-platform -ing` _`codestyling`_ - was done (outprocrastinated and overthinked) by **Daniil Semenenko** [Challanger524](https://github.com/Challanger524)\n- other `tools` `sources` `materials` are not hided or appropriated (at least not intentionally) and are provided with `links` to the original `sources` whenever possible\n- additional thanks to **speauty**'s [ChernoOpenGL](https://github.com/speauty/ChernoOpenGL) implementation for working and mostly accurate code, that was used as a reference for clarification of certain moments and typos, that greatly saved some of my time.\n\n### Changelog: [doc/changelog.md](doc/changelog.md)\n\n### Misc\n- It took a bit more than a month to finish this project and half a day to port on Linux (and a week to polish all warnings and complete documentation)\n- And it took years to polish it all 😐🚬\n- This project helped me to cure 👨‍⚕️ my 👩‍💻`git-` and `cmake-anxiety` ;)\n- Cherno is the only and the best C++ teacher, see also his [C++ playlist](https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb).\n- Motto: \"in case of anything - stay ironically-cynic and/or cynically-ironic `¯\\_(ツ)_/¯`🃏\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchallanger524%2Fchernoopengl-cmake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchallanger524%2Fchernoopengl-cmake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchallanger524%2Fchernoopengl-cmake/lists"}