{"id":16214611,"url":"https://github.com/lfeq/motor","last_synced_at":"2025-10-06T14:51:30.069Z","repository":{"id":243973538,"uuid":"813897573","full_name":"lfeq/Motor","owner":"lfeq","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-17T15:10:17.000Z","size":7153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T22:34:27.239Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lfeq.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":"2024-06-12T00:38:45.000Z","updated_at":"2024-06-17T15:10:20.000Z","dependencies_parsed_at":"2024-06-16T20:01:36.718Z","dependency_job_id":"cb259fac-e4a0-4ee3-be8c-4a5fa42bd955","html_url":"https://github.com/lfeq/Motor","commit_stats":null,"previous_names":["lfeq/motor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lfeq/Motor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FMotor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FMotor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FMotor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FMotor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lfeq","download_url":"https://codeload.github.com/lfeq/Motor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FMotor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278629035,"owners_count":26018480,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"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":[],"created_at":"2024-10-10T11:11:42.459Z","updated_at":"2025-10-06T14:51:30.035Z","avatar_url":"https://github.com/lfeq.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenGL Rendering Engine\n\nThis project is an OpenGL-based rendering engine that demonstrates the use of modern OpenGL features for rendering 2D textures and managing various OpenGL objects like shaders, buffers, and textures. The project is structured into several classes to handle different aspects of rendering, including vertex buffers, index buffers, shaders, textures, and vertex arrays.\n\n## Table of Contents\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Classes](#classes)\n  - [Renderer](#renderer)\n  - [Shader](#shader)\n  - [Texture](#texture)\n  - [VertexArray](#vertexarray)\n  - [VertexBuffer](#vertexbuffer)\n  - [IndexBuffer](#indexbuffer)\n  - [VertexBufferLayout](#vertexbufferlayout)\n- [Dependencies](#dependencies)\n\n## Requirements\n\n- C++17 or later\n- OpenGL 3.3 or later\n- CMake 3.10 or later\n\n## Installation\n\n1. Clone the repository:\n    ```sh\n    git clone https://github.com/lfeq/Motor\n    cd Motor\n    ```\n\n2. Initialize and update submodules (if any):\n    ```sh\n    git submodule update --init --recursive\n    ```\n\n3. Create a build directory and run CMake:\n    ```sh\n    mkdir build\n    cd build\n    cmake ..\n    ```\n\n4. Build the project:\n    ```sh\n    make\n    ```\n\n---\n\n### NOTE\nYou can also open it with Visual Studio 2022, just open the OpenGL.sln file and make sure it's solution platform is set to x86 and **NOT** x64.\n\n## Usage\n\nRun the executable generated in the build directory:\n```sh\n./OpenGLRenderer\n```\n\n## Classes\n\n### Renderer\nThe Renderer `class` encapsulates the drawing operations and error handling for OpenGL calls.\n\n``` c++\nclass Renderer {\npublic:\n    void Clear() const;\n    void Draw(const VertexArray\u0026 va, const IndexBuffer\u0026 ib, const Shader\u0026 shader) const;\n};\n```\n\n### Shader\n\nThe `Shader` class handles the compilation and management of vertex and fragment shaders.\n\n```c++\nclass Shader {\npublic:\n    Shader(const std::string\u0026 filepath);\n    ~Shader();\n\n    void Bind() const;\n    void Unbind() const;\n    void SetUniform1i(const std::string\u0026 name, int value);\n    void SetUniform1f(const std::string\u0026 name, float value);\n    void SetUniform4f(const std::string\u0026 name, float v0, float v1, float v2, float v3);\n    void SetUniformMat4f(const std::string\u0026 name, const glm::mat4\u0026 matrix);\n\nprivate:\n    ShaderProgramSource ParseShader(const std::string\u0026 filepath);\n    unsigned int CompileShader(unsigned int type, const std::string\u0026 source);\n    unsigned int CreateShader(const std::string\u0026 vertexShader, const std::string\u0026 fragmentShader);\n    int GetUniformLocation(const std::string\u0026 name);\n};\n```\n\n### Texture\n\nThe `Texture` class handles the loading and binding of 2D textures.\n\n```c++\nclass Texture {\npublic:\n    Texture(const std::string\u0026 path);\n    ~Texture();\n\n    void Bind(unsigned int slot = 0) const;\n    void Unbind() const;\n\nprivate:\n    unsigned int m_rendererID;\n    std::string m_filepath;\n    unsigned char* m_localBuffer;\n    int m_width, m_height, m_BPP;\n};\n```\n\n### VertexArray\n\nThe `VertexArray` class manages vertex array objects (VAOs).\n\n```c++\nclass VertexArray {\npublic:\n    VertexArray();\n    ~VertexArray();\n    void AddBuffer(const VertexBuffer\u0026 vb, const VertexBufferLayout\u0026 layout);\n    void Bind() const;\n    void Unbind() const;\n};\n```\n\n### VertexBuffer\nThe `VertexBuffer` class manages vertex buffer objects (VBOs).\n\n```c++\nclass VertexBuffer {\npublic:\n    VertexBuffer(const void* data, unsigned int size);\n    ~VertexBuffer();\n\n    void Bind() const;\n    void Unbind() const;\n};\n```\n\n### IndexBuffer\n\nThe `IndexBuffer` class manages index buffer objects (IBOs).\n\n```c++\nclass IndexBuffer {\npublic:\n    IndexBuffer(const unsigned int* data, unsigned int count);\n    ~IndexBuffer();\n\n    void Bind() const;\n    void Unbind() const;\n\n    inline unsigned int GetCount() const { return m_count; }\n};\n```\n\n### VertexBufferLayout\n\nThe `VertexBufferLayout` class defines the layout of vertex buffer data.\n\n```c++\nclass VertexBufferLayout {\npublic:\n    VertexBufferLayout();\n\n    template\u003ctypename T\u003e\n    void Push(unsigned int count);\n\n    inline const std::vector\u003cVertexBufferElement\u003e\u0026 GetElements() const { return m_elements; }\n    inline unsigned int GetStride() const { return m_stride; }\n\nprivate:\n    std::vector\u003cVertexBufferElement\u003e m_elements;\n    unsigned int m_stride;\n};\n```\n\n## Dependencies\n- GLEW\n- GLFW\n- glm\n- stb_image","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfeq%2Fmotor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flfeq%2Fmotor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfeq%2Fmotor/lists"}