This is an automated archive made by the Lemmit Bot.

The original was posted on /r/opensource by /u/iMadz13 on 2023-09-21 14:32:52.


What is StapleGL

StapleGL is a header-only C++20 library that can be effortlessly included into any OpenGL project. It provides RAII abstractions of all the major OpenGL objects, handling their creation, destruction and use for rendering.

In addition, it contains utilities such as a simple shader parser that allows for single file shaders, an instanced VBO class that can be used to implement batched rendering with minimal effort and a way to apply modern C++ algorithms (and other user code, which can even be concurrent) on VBOs and UBOs.

StapleGL is born as a fork of glcore, a similar but unfinished project that only offered a few wrappers around VBOs, VAOs and friends. I worked on the library in my free time during my summer break between my Bachelors and my Masters.

What are it’s use cases

Everyone writing a C++ Engine/Renderer/Application is usually forced to write RAII/OOP wrappers around the OpenGL C API in order to handle the lifetimes of these resources. StapleGL is a ready-made solution to this problem that you can drop in your project, it provides *building blocks* for your application that can be used to construct more complex entities. It does not want to be a fully fledged engine but simply a wrapper that brings OpenGL in the modern world!

Some Results

With the use of StapleGL we are to render the Utah teapot over a background, with post-processing effects such as MSAA x16, HDR, tone-mapping and PBR Bloom. All of this (including creating a GLFW window, rotating over the teapot, allowing the user to scale the brightness, etc…) in under 350 lines of code!

The above examples and more are available in the repository. For more information about the library and its usage, there is extensive documentation in the project’s website.

Since StapleGL is Open Source Software, I gladly accept contributions! I am publicising the project for the first time and I would also like to hear some feedback on the code.

Lastly, if you decide to use StapleGL for your own projects let me know, I will link to your repository from StapleGL’s.