Giter Site home page Giter Site logo

sogl's Introduction

sogl

This is a WIP project

sogl (for Simple OpenGL) is a light library for creating OpenGL applications.

It is best used as a subproject (either using git submodules or CMake FetchContent)

The goal of this library is to provide quick and simple tools for creating OpenGL applications. It is not meant to become a fully fledged graphics API, just the minimum to be able to start right off the bat and get going.

Supported features

  • Easily open a Window with an OpenGL context
  • Window events (KeyPress/KeyRelease, MousePress/MouseRelease, MouseMove, Scroll, Resize, Drop)
  • Textures from file
  • Shaders (vertex and fragment)
  • VertexArray (using vertex buffers and index buffers)

Get started

Just download sogl and add this line to your CMakeLists

add_subdirectory(sogl)

sogl will automatically download and link its dependencies.

Here is a sample code to try out :

#include <iostream>
#include <sogl/sogl.hpp>

int main() {
    auto window = sogl::Window(1000, 800, "Triangle demo");

    while (window.isOpen()) {
        while (auto event = window.nextEvent()) {
            if (auto key = event->as<sogl::Event::Key>()) {
                if (key->key == GLFW_KEY_ESCAPE) {
                    window.close();
                }
            }
            else if (auto click = event->as<sogl::Event::MouseButton>()){
                if (click->button == GLFW_MOUSE_BUTTON_LEFT && click->action == GLFW_PRESS) {
                    auto mouse_pos = window.getMousePosition();
                    std::cout << "Left click at (" << mouse_pos.x << ", " << mouse_pos.y << ")\n";
                }
            }
        }
        window.clear();
        window.display();
    }

    return 0;
}

Examples

Showcase

screenshot1

sogl's People

Contributors

madour avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.