SlimShader

Graphics · C++ · OpenGL

SlimShader

A Lightweight C++ Material and Shader Library for SFML

Overview

SlimShader is a C++ library that wraps SFML's shader system into a clean, object-oriented Material abstraction. Instead of manually managing shader uniforms and textures per draw call, materials encapsulate all shader state and can be applied to any SFML drawable in a single line.

The library is designed for composability — custom materials are created by inheriting from the base Material class, implementing initialize() for shader loading and update() for per-frame uniform updates.

Features

Material System

High-level abstraction for shaders with built-in parameter management. Wraps SFML shaders into composable, reusable material objects.

Uniform Management

Simplified API for setting shader uniforms — floats, vectors, textures — without manual SFML boilerplate.

Texture Caching

Automatic texture loading and caching system prevents redundant disk reads across materials.

RenderableObject

Combines SFML drawables with materials into a single object, letting you update and render in one call.

MFire Material

Animated procedural fire effect with customizable primary, secondary, and tertiary flame colors.

Extensible Architecture

Create custom materials by inheriting from the base Material class and overriding initialize() and update().

Usage

MFire* mFire = new MFire(&textureLoader);
mFire->initialize();
mFire->setFireColors(
  sf::Glsl::Vec4(1.0f, 0.2f, 0.1f, 1.0f),  // inner
  sf::Glsl::Vec4(1.0f, 0.6f, 0.0f, 1.0f),  // mid
  sf::Glsl::Vec4(1.0f, 1.0f, 0.0f, 1.0f)   // outer
);

Technology

C++GLSLSFMLOpenGL