Giter Site home page Giter Site logo

playgl's Introduction

playgl

An OpenGL playground for experimenting with graphics.

example

Playgl is a C++ header-only library for OpenGL prototyping (version 4.6-core). It was created as an easy-to-use playground for rendering techniques. It tries to abstract nitty-gritty details of gpu to allow user to focus on shaders workflow. It tries to keep GPU abstraction lightweight to allow easy tinkering if one needs it. Currently it supports only Windows MSVC compiler (C++17). The library is still in early stage of development and it is bound to change.

Features

  • Orbit camera support
  • Editable parameters with automatic GUI and shader propagation
  • Built-in primitives support
  • Debug renderer
  • Basic support for static models (gltf 2.0)
  • Basic support for textures (stb_image)
  • Postprocessing workflow API
  • Gpu state caching
  • OpenGL debugging support (output, labels, scopes)

Dependencies

  • glfw
  • glad
  • glm
  • imgui
  • stb_image
  • par_shapes
  • meow_hash
  • tinygltf
  • fmt

Example

#define PGL_DEFINE_MAIN
#include "playgl.h"

void pgl_init(Store& store) {
    store["screen_color"] = Color(0.5f, 0.5f, 0.5);
    store["PHONG_COLOR"] = Color(0.7f, 0.4f, 0.3f);
    store["LIGHT_COLOR"] = Color(0.8f, 0.2f, 0.4f);

    store["test_bounded"] = BoundedParam(vec4(-1.f, 15.f, 32.f, -3.f), -5, 50);
}

void pgl_update(System& system) {
    system.camera.canvas.color = system.store["screen_color"];
};

void pgl_render(System& system) {
    system.geometry(geometry::TrefoilKnot<>{})
        .shader("phong.vs", "phong.fs")
        .param("world", mat4(1.f))
        .param("view", system.camera.geometry.get_view())
        .param("projection", system.camera.geometry.get_projection())
        .render();

    system.debug.grid().edge(10.f);
    system.debug.model("test.glb");
    system.debug.texture(
        system.camera.canvas.framebuffer.color_texture.value());

    system.postprocess(system.camera.canvas.framebuffer)
        .with("grayscale.fs")
        .resulting("#grayscale");

    system.postprocess("#grayscale")
        .with("postprocess.fs")
        .resulting(system.camera.canvas.framebuffer);
};

playgl's People

Contributors

panmar avatar

Watchers

James Cloos avatar  avatar  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.