therselman / SimpleGraphicsLibrary

A simple library for learning and experimenting with Graphics APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Graphics Library (SGL)

A simple library for learning and experimenting with Graphics APIs, written in C++. For now, supports only OpenGL 4.5.

Features:

  • Abstractions of OpenGL objects for use under the RAII concept:
    • Shader, VertexBuffer, IndexBuffer, Texture2D, CubeMapTexture, etc
  • Window abstraction using GLFW3
  • Application base class for quick and clean prototyping
  • Logging abstraction
  • ImGui integration into Application base class

Used Libraries:

  • window abstraction: GLFW3
  • OpenGL headers: GLAD
  • logging library: SPDLOG
  • math library: GLM
  • gui library: ImGui
  • image loading library: STB

How to Use

See examples/ directory.

Use '--recursive' when cloning.

Style used: Google C++ Style

Example of an app that uses Application as a base class:

#define SGL_USE_IMGUI
#include <SGL/SGL.h>
Class HelloTriangle : public sgl::Application
{
...
protected:
    virtual void Start() override {
        m_Window->SetWindowSizeCallback(HelloTriangle::OnResize);
    }
    virtual void Update(float dt) override;
    virtual void Render() override {
        glClear(GL_COLOR_BUFFER_BIT);
        ...
    }
    virtual void OnImGuiRender() override {
        ImGui::ShowDemoWindow(&mybool);
    }
...
}

License

Distributed under MIT License Copyright (c) 2022 authors

Release Notes

version 0.2

  • Texture support:
    • image loading
    • Texture2D abstraction
  • IndexBuffer abstraction
  • TexturedQuad example
  • code readability updates
  • fixes to make the SGL usable as a library, not just a standalone project
  • support for loading binary and text files
  • ImGui integration, Application base class updates
  • CubeMapTexture abstraction

Version 0.1

  • Window abstraction using GLFW
  • GL function loading using GLAD
  • Logging abstraction using SPDLOG, along with custom asserts
  • Added GLM as math library
  • VertexBuffer abstraction
  • VertexArray abstraction
  • Shaders abstraction
  • Examples:
    • HelloTriangle
    • VertexBuffers
  • other core modules:
    • Timer, Timestep
  • Application base class

About

A simple library for learning and experimenting with Graphics APIs

License:MIT License


Languages

Language:C 87.4%Language:C++ 11.7%Language:CMake 0.9%