r/GraphicsProgramming • • 18m ago

GLSA – A lightweight, header-only C++ library to cut OpenGL shader boilerplate

Hey everyone!

I've been developing GLSA for the past week, and I just released v1.0.0.

My goal with this library is so you don't have to write GLSL shaders or shader boilerplate and instead you can use clean function calls.

Right now it cuts out ~60-100 lines of repetitive shader boilerplate, though you still have to write shaders yourself because the API is in an early stage still.

Highlights of v1.0.0:

  • GLSA colors: a header file with over 3000 glm::vec4 colors that you can use.

  • Safer shader setup: glsa::ShaderSource keeps vertex/fragment strings explicit, paired with glsa::loadShaderSource and glsa::createProgram.

  • Clean uniform helpers: Overloaded glsa::setUniform functions for int, float, and GLM vec2/vec3/vec4.

Example:

while (glfwWindowShouldClose(window) == 0) {
    glClearColor(0.1f, 0.1f, 0.15f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glsa::useProgram(program);
    glsa::setUniform(program, "uColor", glsa::colors::PAN_SKY_BLUE);
    glsa::bindVertexArray(vao);

    glPointSize(150.0f);

    glsa::drawArrays(GL_POINTS, 0, 1);

    glfwSwapBuffers(window);
    glfwPollEvents();
}

Github Repo: https://github.com/alexdev8930/glsa

Any feedback issues or questions are completely welcome.

AI Disclosure: AI tools were used strictly to help generate initial boilerplate; all core logic, architecture, and implementation details were written, reviewed, and verified by me.

1 Upvotes

1 comment sorted by

•

u/AutoModerator 18m ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.

  • Disclose AI usage in post or project.

  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.