This is a C++ OpenGL wrapper mostly for personal use. It is not intended to abstract away OpenGL, but just make it more usable in C++ and in general. If you wish to use this, you still need to know how OpenGL works.
The glw
namespace consists of thin wrappers over OpenGL objects (so thin that there should be little dispute about design choices). They can also store state that is stored inside the OpenGL object, so you can query it easily (e.g. for buffers: size of data store, for shader programs: attached shaders, for textures: tons of shit). Most of these objects are non-copiable and non-assignable, because the OpenGL objects they own are sort of like pointers in that you should only delete them once and they can't be copied easily. It contains the following classes:
- Buffer (Buffer Objects)
- Framebuffer (Framebuffer Objects)
- Renderbuffer (Renderbuffer Objects)
- Shader & ShaderProgram (Shader and Program Objects)
- State (A manager for some of OpenGLs global state)
- Texture (Texture Objects)
- VertexArray (Vertex Array Objects)
- VertexFormat (oops, this should be in glwx, but I won't change it now)
and a bunch of enums and logging.
The glwx
namespace contains mostly high-level stuff that I need for most projects using OpenGL. Especially helpers to create the objects listed above (including from filesystem). The idea is to rather have not enough than too much (and introduce too much abstractions/design choices/opinions). The goal is still (for this whole library) to keep it as generic as I can, but include everything that I need all the time.
It includes:
- Helper classes:
- Higher-Level wrappers:
- Object creation helpers:
- Window creation with SDL2 (header)
- Helpers for OpenGL's debug API (header)
- A batched sprite renderer for 2D geometry (polygons, lines) (header)
- Some math functions
- The
Mesh
class is pretty useless, but the idea is to provide aPrimitive
that also owns it's buffers. In my engines at least the Buffers are often shared though, so maybe I want the mesh to have avector<shared_ptr<Buffer>>
? Most of the time you want a mesh to represent multiple drawcalls anyways. Would I need some Material abstraction to make this useful? In that case this would be entirely inappropriate for this library. Maybe I should just delete Mesh? Then I can't really use meshgen though. - Support ivec/dvec vertex attributes (glVertexAttribIPointer/glVertexAttribLPointer)
- Text Rendering? I have already prepared this, but it requires an additional dependency (cppasta) for UTF-8 functions and I am not sure if I want that.
- Imgui integration? (this is very simple to do in a project though)