{"id":20128521,"url":"https://github.com/cococry/sgll","last_synced_at":"2026-05-05T16:39:18.798Z","repository":{"id":212172378,"uuid":"521290068","full_name":"cococry/SGLL","owner":"cococry","description":"Simple GL Library","archived":false,"fork":false,"pushed_at":"2022-08-09T19:03:33.000Z","size":25143,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T08:30:28.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cococry.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":"2022-08-04T14:04:12.000Z","updated_at":"2023-02-25T09:08:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4545c47-2622-4d2c-a837-aba5292a4949","html_url":"https://github.com/cococry/SGLL","commit_stats":null,"previous_names":["cococry/sgll"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cococry%2FSGLL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cococry%2FSGLL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cococry%2FSGLL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cococry%2FSGLL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cococry","download_url":"https://codeload.github.com/cococry/SGLL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241572652,"owners_count":19984314,"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":[],"created_at":"2024-11-13T20:27:28.546Z","updated_at":"2026-05-05T16:39:18.743Z","avatar_url":"https://github.com/cococry.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SGLL - Simple GL Library\n\u003cimage src=\"git-assets/sgll_logo.png\" alt=\"logo\" width=500px\u003e\u003c/image\u003e\n\n## Overview\nSGLL is a simple abstraction over boilerplate code that is used by any general [OpenGL](https://de.wikipedia.org/wiki/OpenGL) program. The API contains \nclasses for IO- and display management (Keyboard, Mouse) and a OpenGL Texture- And Shader class. A few utility features are also in the API. This Library is desinged\nto start your OpenGL project easily without needing to worry about any boilterplate that could take pretty long to implement and lowers motivation. The API does not\ncontain high level features of some sort. The main focus is IO and Windowing. The Library is developed in C++ using the Visual Studio 2022 IDE. The Build at the time\nis only setup for Visual Studio building. The plan is to port the library to clang and gcc.\n\n***\n\n## 🛬 Building\n\n*VISUAL STUDIO REQUIRED* First, Link your project to the [SGLL.lib file](https://github.com/cococry/SGLL/blob/main/lib/SGLL.lib). This will give you core access to\nthe library. Now, setup include paths to include from SGLL. Set a additional include directory for the [libraries include directory](https://github.com/cococry/SGLL/tree/main/SGLL/include/sgll). Finally, include all the c++ files in the [libraries source folder](https://github.com/cococry/SGLL/tree/main/SGLL/src) to the build of your project.\n\nThat's it! \n\n## 💥Features\n\n- Keyboard IO  \n- Mouse IO \n- Windowing Class \n- Defined Mouse Codes\n- Defined Key Codes\n- OpenGL Shader Class\n- OpenGL Texture Class\n- File Utility Methods\n- Logging at different Log Levels\n- Easy Delta Time Access\n\n## Notes\n\nThe majority of the Display class implementation was made by use of the [GLFW](https://github.com/GLFW/GLFW) library for windowing. Same for IO, GLFW was used for the\nlow level implementation. For accessing OpenGL Functions, the library [glad](https://github.com/Dav1dde/glad) was used. The logging class is a abstraction of the [spdlog](https://github.com/gabime/spdlog) library. And lastly, [stb_image](https://github.com/nothings/stb) is used for loading textures.\n\n***\n\n## 🧾 Brief documentation\n\n- **Display Class**\n\nThe Display class is a abstraction over the GLFWWindow struct. It contatins API to intialize, deintialize and handle the GLFW Window. It also contains API to change the way the window behaves at runtime and functionally to get and set variables that make up the Window.\n\n```C\n SGLL::Display display = SGLL::Display(1920, 1080, \"My SGLL Window\");\n \n display.setVsync(true);\n \n SGLL_INFO(\"Window is {0}x{1} pixels big\", display.getWidth(), display.getHeight());\n \n while(!display.closeRequested)\n{\n  display.pollEvents();\n  display.swapBuffers();\n}\n\n```\n\n- **Keyboard Input**\n\nThe API of Keyboard Input in SGLL conains querying states of keys. Examples are testing if a key was pressed in the last frame, if a key is currently pressed or if a key was released. The is done by binding a callback function to GLFWs key callback that handles the key states.\n\n```C\nif(SGLL::Keyboard::isKeyPressed(SGLL::Key::W)\n{\n  SGLL_ERROR(\"Key W is currently pressed\");\n}\nelse if(SGLL::Keyboard::wentKeyDown(SGLL::Key::A)\n{\n  SGLL_WARN(\"A Key went down!\");\n}\nelse if(SGLL::Keyboard::isKeyReleased(SGLL::Key::S)\n{\n  SGLL_TRACE(\"The S key has been released\");\n}\nelse if(SGLL::Keyboard::keyChanged(SGLL::Key::D)\n{\n  SGLL_CRITICAL(\"The state of the D key was changed);\n}\n```\n\n- **Mouse Input**\n\nThe API of for Mouse Input in SGLL contains a lot of methods for checking all kinds of states and variables of the mouse. Containing checking the position of the mouse, checking button states, querying the mouse wheel and even more. The is made by binding callback functions to GLFW. Those a contain Button state callback, a Mouse wheel callback and a cursor position callback.\n\n```C\nif(SGLL::Mouse::isButtonPressed(SGLL::MouseCode::ButtonLeft)\n{\n  SGLL_INFO(\"The left mouse button is being pressed!\");\n}\nelse if(SGLL::Mouse::isButtonReleased(SGLL::MouseCode::ButtonLeft)\n{\n  SGLL_ERROR(\"The left mouse button was released.\");\n}\n\nSGLL_INFO(\"Mouse position is: {0}x{1}\", SGLL::Mouse::getXPos(), SGLL::Mouse::getYPos());\n```\n\n- **Logging**\n\nThe Logging API contains macros for logging at different log levels. Those Levels are: Debug, Trace, Info, Warn, Error and Critical. The logging is done\nwith [spdlog](https://github.com/gabime/spdlog).\n\n```C\nSGLL_DEBUG(\"Hello debug. 12 + 5 = {0}\", 17);\nSGLL_TRACE(\"Hello trace. Mouse Position: {0}x{1}\", SGLL::Mouse::getXPos(), SGLL::Mouse::getYPos());\nSGLL_INFO(\"Hello info\");\nSGLL_WARN(\"Hello warn\");\nSGLL_ERROR(\"Hello error\");\nSGLL_CRITICAL(\"Hello critical\");\n```\n\n- **Textures**\n\nSGLL Also contains API to load textures into OpenGL memory. This is contained by the texture class. The actual parsing and file loading is done with [stb_image](https://github.com/nothings/stb).\n\n\n```C\nSGLL::Texture texture = SGLL::Texture(\"assets/textures/grass.png\");\n\ntexture.bind();\ntexture.activate();\n\nSGLL_INFO(\"Texture size: {0}x{1}\", texture.getWidth(), texture.getHeight());\n```\n\n- **Shaders**\n\nThe Shader API is an abstraction over the OpenGL Shader program. It contains loading shader files from vertex, fragment and optionally geometry shaders and compiling\nthem. The API also contains methods to upload uniforms to the shader of 10 different variable types.\n\n\n```C\nSGLL::Shader shader = SGLL::Shader(\"assets/shaders/vertex_shader.glsl\", \"assets/shaders/fragment_shader.glsl\", \"assets/shaders/geometry_shader.glsl\");\n\nshader.bind();\nshader.setMatrix4f(\"u_ViewProjectionMatrix\", viewProjectionMatrix);\nshader.setVector3f(\"uViewPos\", camera.position);\nshader.unbind();\n```\n\n- **Loading File Contents**\n\nSGLL also has functionallity for loading up text files and storing its contents in strings.\n\n\n```C\n\nstd::string fileContent = SGLL::FileUtil::getFileContents(\"assets/files/diary.txt\");\n\nSGLL_INFO(\"My diary: {0}\", fileContent);\n```\n\n***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcococry%2Fsgll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcococry%2Fsgll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcococry%2Fsgll/lists"}